RegisterDialContext registers a custom dial function. It can then be used by the network address mynet(addr), where mynet is the registered new network. The current context for the connection and its address is passed to the dial function.
(net string, dial DialContextFunc)
| 47 | // network address mynet(addr), where mynet is the registered new network. |
| 48 | // The current context for the connection and its address is passed to the dial function. |
| 49 | func RegisterDialContext(net string, dial DialContextFunc) { |
| 50 | dialsLock.Lock() |
| 51 | defer dialsLock.Unlock() |
| 52 | if dials == nil { |
| 53 | dials = make(map[string]DialContextFunc) |
| 54 | } |
| 55 | dials[net] = dial |
| 56 | } |
| 57 | |
| 58 | // DeregisterDialContext removes the custom dial function registered with the given net. |
| 59 | func DeregisterDialContext(net string) { |