aboutsummaryrefslogtreecommitdiffstats
path: root/tun_linux.go
diff options
context:
space:
mode:
authorMathias Hall-Andersen <mathias@hall-andersen.dk>2018-02-11 18:55:30 +0100
committerMathias Hall-Andersen <mathias@hall-andersen.dk>2018-02-11 18:55:30 +0100
commit73cb1a115569455566e7091ce8d98f31e4fdfddf (patch)
tree0bc62575681965dbd14a0dc64df2b9af252135f0 /tun_linux.go
parentStarted migration to sub-packages (diff)
downloadwireguard-go-73cb1a115569455566e7091ce8d98f31e4fdfddf.tar.xz
wireguard-go-73cb1a115569455566e7091ce8d98f31e4fdfddf.zip
Reverted event changes
This feature was not needed for Android, upon further inspection.
Diffstat (limited to 'tun_linux.go')
-rw-r--r--tun_linux.go25
1 files changed, 12 insertions, 13 deletions
diff --git a/tun_linux.go b/tun_linux.go
index 4585b13..daa2462 100644
--- a/tun_linux.go
+++ b/tun_linux.go
@@ -7,7 +7,6 @@ import (
"encoding/binary"
"errors"
"fmt"
- "git.zx2c4.com/wireguard-go/internal/events"
"golang.org/x/net/ipv6"
"golang.org/x/sys/unix"
"net"
@@ -53,10 +52,10 @@ const (
type NativeTun struct {
fd *os.File
- index int32 // if index
- name string // name of interface
- errors chan error // async error handling
- events chan events.Event // device related events
+ index int32 // if index
+ name string // name of interface
+ errors chan error // async error handling
+ events chan TUNEvent // device related events
}
func (tun *NativeTun) File() *os.File {
@@ -72,9 +71,9 @@ func (tun *NativeTun) RoutineHackListener() {
_, err := unix.Write(fd, nil)
switch err {
case unix.EINVAL:
- tun.events <- events.NewEvent(TUNEventUp)
+ tun.events <- TUNEventUp
case unix.EIO:
- tun.events <- events.NewEvent(TUNEventDown)
+ tun.events <- TUNEventDown
default:
}
time.Sleep(time.Second / 10)
@@ -119,14 +118,14 @@ func (tun *NativeTun) RoutineNetlinkListener() {
}
if info.Flags&unix.IFF_RUNNING != 0 {
- tun.events <- events.NewEvent(TUNEventUp)
+ tun.events <- TUNEventUp
}
if info.Flags&unix.IFF_RUNNING == 0 {
- tun.events <- events.NewEvent(TUNEventDown)
+ tun.events <- TUNEventDown
}
- tun.events <- events.NewEvent(TUNEventMTUUpdate)
+ tun.events <- TUNEventMTUUpdate
default:
remain = remain[hdr.Len:]
@@ -289,7 +288,7 @@ func (tun *NativeTun) Read(buff []byte, offset int) (int, error) {
}
}
-func (tun *NativeTun) Events() chan events.Event {
+func (tun *NativeTun) Events() chan TUNEvent {
return tun.events
}
@@ -301,7 +300,7 @@ func CreateTUNFromFile(name string, fd *os.File) (TUNDevice, error) {
device := &NativeTun{
fd: fd,
name: name,
- events: make(chan events.Event, 5),
+ events: make(chan TUNEvent, 5),
errors: make(chan error, 5),
}
@@ -358,7 +357,7 @@ func CreateTUN(name string) (TUNDevice, error) {
device := &NativeTun{
fd: fd,
name: newName,
- events: make(chan events.Event, 5),
+ events: make(chan TUNEvent, 5),
errors: make(chan error, 5),
}