diff --git a/AUTHORS b/AUTHORS index fb1478c3b..ea9b96789 100644 --- a/AUTHORS +++ b/AUTHORS @@ -47,6 +47,7 @@ INADA Naoki Jacek Szwec James Harr Janek Vedock +Jean-Yves Pellé Jeff Hodges Jeffrey Charles Jerome Meyer diff --git a/driver.go b/driver.go index ad7aec215..8b0c3ec0a 100644 --- a/driver.go +++ b/driver.go @@ -55,6 +55,17 @@ func RegisterDialContext(net string, dial DialContextFunc) { dials[net] = dial } +// DeregisterDialContext removes the custom dial function registered with the given net. +func DeregisterDialContext(net string) { + dialsLock.Lock() + defer dialsLock.Unlock() + if dials != nil { + if _, ok := dials[net]; ok { + delete(dials, net) + } + } +} + // RegisterDial registers a custom dial function. It can then be used by the // network address mynet(addr), where mynet is the registered new network. // addr is passed as a parameter to the dial function.