4
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2025-07-04 12:27:47 +00:00

Add support for specifying TCP source interface, i.e. tcp://a.b.c.d:e/eth0, for multiple simultaneous peerings to the same node over different interfaces

This commit is contained in:
Neil Alexander
2018-09-25 15:32:45 +01:00
parent 4666b8f6cd
commit aecc151baf
3 changed files with 49 additions and 14 deletions

View File

@ -395,7 +395,11 @@ func (a *admin) addPeer(addr string) error {
if err == nil {
switch strings.ToLower(u.Scheme) {
case "tcp":
a.core.tcp.connect(u.Host)
if len(u.Path) > 1 {
a.core.tcp.connect(u.Host, u.Path[1:])
} else {
a.core.tcp.connect(u.Host, "")
}
case "socks":
a.core.tcp.connectSOCKS(u.Host, u.Path[1:])
default:
@ -407,7 +411,7 @@ func (a *admin) addPeer(addr string) error {
if strings.HasPrefix(addr, "tcp:") {
addr = addr[4:]
}
a.core.tcp.connect(addr)
a.core.tcp.connect(addr, "")
return nil
}
return nil