mirror of
https://git.zx2c4.com/wireguard-go
synced 2024-11-15 01:05:15 +01:00
Print utun name on darwin
This commit is contained in:
parent
7a1a537f43
commit
28c7eb4335
@ -184,7 +184,7 @@ func (node *trieEntry) entriesForPeer(p *Peer, results []net.IPNet) []net.IPNet
|
|||||||
mask := net.CIDRMask(int(node.cidr), len(node.bits)*8)
|
mask := net.CIDRMask(int(node.cidr), len(node.bits)*8)
|
||||||
results = append(results, net.IPNet{
|
results = append(results, net.IPNet{
|
||||||
Mask: mask,
|
Mask: mask,
|
||||||
IP: node.bits.Mask(mask),
|
IP: node.bits.Mask(mask),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
results = node.child[0].entriesForPeer(p, results)
|
results = node.child[0].entriesForPeer(p, results)
|
||||||
|
@ -12,6 +12,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"golang.org/x/net/ipv6"
|
"golang.org/x/net/ipv6"
|
||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
|
"io/ioutil"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
@ -104,7 +105,10 @@ func CreateTUN(name string) (TUNDevice, error) {
|
|||||||
tun, err := CreateTUNFromFile(os.NewFile(uintptr(fd), ""))
|
tun, err := CreateTUNFromFile(os.NewFile(uintptr(fd), ""))
|
||||||
|
|
||||||
if err == nil && name == "utun" {
|
if err == nil && name == "utun" {
|
||||||
fmt.Printf("OS assigned interface: %s\n", tun.(*NativeTun).name)
|
fname := os.Getenv("WG_DARWIN_UTUN_NAME_FILE")
|
||||||
|
if fname != "" {
|
||||||
|
ioutil.WriteFile(fname, []byte(tun.(*NativeTun).name+"\n"), 0400)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return tun, err
|
return tun, err
|
||||||
|
Loading…
Reference in New Issue
Block a user