mirror of
https://github.com/slackhq/nebula.git
synced 2025-11-22 16:34:25 +01:00
Make Interface.Inside an interface type (#252)
This commit updates the Interface.Inside type to be a new interface type instead of a *Tun. This will allow for an inside interface that does not use a tun device, such as a single-binary client that can run without elevated privileges.
This commit is contained in:
10
tun_ios.go
10
tun_ios.go
@@ -30,13 +30,13 @@ func newTunFromFd(deviceFd int, cidr *net.IPNet, defaultMTU int, routes []route,
|
||||
file := os.NewFile(uintptr(deviceFd), "/dev/tun")
|
||||
ifce = &Tun{
|
||||
Cidr: cidr,
|
||||
Device: "iOS",
|
||||
ReadWriteCloser: &tunReadCloser{f: file},
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (c *Tun) Activate() error {
|
||||
c.Device = "iOS"
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -103,3 +103,11 @@ func (t *tunReadCloser) Write(from []byte) (int, error) {
|
||||
func (t *tunReadCloser) Close() error {
|
||||
return t.f.Close()
|
||||
}
|
||||
|
||||
func (c *Tun) CidrNet() *net.IPNet {
|
||||
return c.Cidr
|
||||
}
|
||||
|
||||
func (c *Tun) DeviceName() string {
|
||||
return c.Device
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user