Merge branch 'develop' into nodeconfig

This commit is contained in:
Neil Alexander 2019-01-14 14:01:38 +00:00
commit 738a9da796
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
22 changed files with 734 additions and 85 deletions

View file

@ -15,6 +15,7 @@ package yggdrasil
// See version.go for version metadata format
import (
"context"
"errors"
"fmt"
"io"
@ -120,7 +121,11 @@ func (iface *tcpInterface) listen() error {
iface.tcp_timeout = default_tcp_timeout
}
iface.serv, err = net.Listen("tcp", iface.tcp_addr)
ctx := context.Background()
lc := net.ListenConfig{
Control: iface.tcpContext,
}
iface.serv, err = lc.Listen(ctx, "tcp", iface.tcp_addr)
if err == nil {
iface.calls = make(map[string]struct{})
iface.conns = make(map[tcpInfo](chan struct{}))
@ -212,7 +217,9 @@ func (iface *tcpInterface) call(saddr string, socksaddr *string, sintf string) {
},
}
} else {
dialer := net.Dialer{}
dialer := net.Dialer{
Control: iface.tcpContext,
}
if sintf != "" {
ief, err := net.InterfaceByName(sintf)
if err != nil {