First set of code review patches
This commit is contained in:
parent
22c83f4b8d
commit
8c34c4cbb3
15 changed files with 315 additions and 182 deletions
|
|
@ -7,6 +7,7 @@ import (
|
|||
"encoding/binary"
|
||||
"errors"
|
||||
"golang.org/x/sys/unix"
|
||||
"net"
|
||||
"os"
|
||||
"strings"
|
||||
"unsafe"
|
||||
|
|
@ -19,6 +20,11 @@ type NativeTun struct {
|
|||
name string
|
||||
}
|
||||
|
||||
func (tun *NativeTun) IsUp() (bool, error) {
|
||||
inter, err := net.InterfaceByName(tun.name)
|
||||
return inter.Flags&net.FlagUp != 0, err
|
||||
}
|
||||
|
||||
func (tun *NativeTun) Name() string {
|
||||
return tun.name
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue