ipn/{ipnlocal,localapi}: add localapi handler to dial/proxy file PUTs

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2021-04-06 13:38:47 -07:00
committed by Brad Fitzpatrick
parent 3089081349
commit 1f99f889e1
4 changed files with 138 additions and 15 deletions

View File

@@ -19,6 +19,7 @@ import (
"strings"
"sync"
"sync/atomic"
"syscall"
"time"
"inet.af/netaddr"
@@ -2155,3 +2156,16 @@ func (b *LocalBackend) CheckIPForwarding() error {
}
return nil
}
// peerDialControlFunc is non-nil on platforms that require a way to
// bind to dial out to other peers.
var peerDialControlFunc func(*LocalBackend) func(network, address string, c syscall.RawConn) error
// PeerDialControlFunc returns a net.Dialer.Control func (possibly nil) to use to
// dial other Tailscale peers from the current environment.
func (b *LocalBackend) PeerDialControlFunc() func(network, address string, c syscall.RawConn) error {
if peerDialControlFunc != nil {
return peerDialControlFunc(b)
}
return nil
}