mirror of
https://github.com/tailscale/tailscale.git
synced 2025-12-04 20:09:03 +00:00
all: cleanup unused code, part 1 (#10661)
Run `staticcheck` with `U1000` to find unused code. This cleans up about a half of it. I'll do the other half separately to keep PRs manageable. Updates #cleanup Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
This commit is contained in:
@@ -26,7 +26,7 @@ func peerDialControlFuncNetworkExtension(d *Dialer) func(network, address string
|
||||
defer d.mu.Unlock()
|
||||
|
||||
index := -1
|
||||
if x, ok := d.interfaceIndexLocked(d.tunName); ok {
|
||||
if x, ok := interfaceIndexLocked(d); ok {
|
||||
index = x
|
||||
}
|
||||
var lc net.ListenConfig
|
||||
@@ -38,3 +38,15 @@ func peerDialControlFuncNetworkExtension(d *Dialer) func(network, address string
|
||||
return lc.Control(network, address, c)
|
||||
}
|
||||
}
|
||||
|
||||
func interfaceIndexLocked(d *Dialer) (index int, ok bool) {
|
||||
if d.netMon == nil {
|
||||
return 0, false
|
||||
}
|
||||
st := d.netMon.InterfaceState()
|
||||
iface, ok := st.Interface[d.tunName]
|
||||
if !ok {
|
||||
return 0, false
|
||||
}
|
||||
return iface.Index, true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user