mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-25 19:15:34 +00:00
net/interfaces: add debugging code for crawshaw
This commit is contained in:
parent
6e4231c03c
commit
7823f665ad
@ -6,6 +6,9 @@
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
||||
"go4.org/mem"
|
||||
@ -46,8 +49,10 @@ func likelyHomeRouterIPDarwinExec() (ret netaddr.IP, ok bool) {
|
||||
}
|
||||
defer cmd.Wait()
|
||||
|
||||
fmt.Println("netstat output:")
|
||||
tee := io.TeeReader(stdout, os.Stdout)
|
||||
var f []mem.RO
|
||||
lineread.Reader(stdout, func(lineb []byte) error {
|
||||
lineread.Reader(tee, func(lineb []byte) error {
|
||||
line := mem.B(lineb)
|
||||
if !mem.Contains(line, mem.S("default")) {
|
||||
return nil
|
||||
|
@ -105,6 +105,7 @@
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
|
||||
"inet.af/netaddr"
|
||||
)
|
||||
@ -116,6 +117,7 @@ func init() {
|
||||
func likelyHomeRouterIPDarwinSyscall() (ret netaddr.IP, ok bool) {
|
||||
ip := C.privateGatewayIP()
|
||||
if ip < 255 {
|
||||
fmt.Println("privateGatewayIP failure:", ip)
|
||||
return netaddr.IP{}, false
|
||||
}
|
||||
var q [4]byte
|
||||
|
Loading…
Reference in New Issue
Block a user