aboutsummaryrefslogtreecommitdiff
path: root/tun/tun_darwin.go
diff options
context:
space:
mode:
authorMatt Layher <mdlayher@gmail.com>2019-06-10 17:33:40 -0400
committerJason A. Donenfeld <Jason@zx2c4.com>2019-06-14 18:35:57 +0200
commit1f48971a80f48257e478e532f6971d0557026120 (patch)
treecd2a3b83a1b3d5e09d5e8283c61d29537f0cbf3e /tun/tun_darwin.go
parent3371f8dac6fe6bbd7522a8316b50f6473012e302 (diff)
downloadwireguard-go-1f48971a80f48257e478e532f6971d0557026120.tar.gz
wireguard-go-1f48971a80f48257e478e532f6971d0557026120.zip
tun: remove TUN prefix from types to reduce stutter elsewhere
Signed-off-by: Matt Layher <mdlayher@gmail.com>
Diffstat (limited to 'tun/tun_darwin.go')
-rw-r--r--tun/tun_darwin.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/tun/tun_darwin.go b/tun/tun_darwin.go
index 8cd22a8..0815495 100644
--- a/tun/tun_darwin.go
+++ b/tun/tun_darwin.go
@@ -35,7 +35,7 @@ type sockaddrCtl struct {
type NativeTun struct {
name string
tunFile *os.File
- events chan TUNEvent
+ events chan Event
errors chan error
routeSocket int
}
@@ -86,22 +86,22 @@ func (tun *NativeTun) routineRouteListener(tunIfindex int) {
// Up / Down event
up := (iface.Flags & net.FlagUp) != 0
if up != statusUp && up {
- tun.events <- TUNEventUp
+ tun.events <- EventUp
}
if up != statusUp && !up {
- tun.events <- TUNEventDown
+ tun.events <- EventDown
}
statusUp = up
// MTU changes
if iface.MTU != statusMTU {
- tun.events <- TUNEventMTUUpdate
+ tun.events <- EventMTUUpdate
}
statusMTU = iface.MTU
}
}
-func CreateTUN(name string, mtu int) (TUNDevice, error) {
+func CreateTUN(name string, mtu int) (Device, error) {
ifIndex := -1
if name != "utun" {
_, err := fmt.Sscanf(name, "utun%d", &ifIndex)
@@ -171,10 +171,10 @@ func CreateTUN(name string, mtu int) (TUNDevice, error) {
return tun, err
}
-func CreateTUNFromFile(file *os.File, mtu int) (TUNDevice, error) {
+func CreateTUNFromFile(file *os.File, mtu int) (Device, error) {
tun := &NativeTun{
tunFile: file,
- events: make(chan TUNEvent, 10),
+ events: make(chan Event, 10),
errors: make(chan error, 5),
}
@@ -244,7 +244,7 @@ func (tun *NativeTun) File() *os.File {
return tun.tunFile
}
-func (tun *NativeTun) Events() chan TUNEvent {
+func (tun *NativeTun) Events() chan Event {
return tun.events
}