mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03: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:
parent
4666b8f6cd
commit
aecc151baf
3 changed files with 49 additions and 14 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue