Rework freebsd support

This commit is contained in:
Jason A. Donenfeld
2018-05-21 17:27:18 +02:00
parent b962d7d791
commit ff3f2455e5
10 changed files with 182 additions and 353 deletions

View File

@@ -227,7 +227,7 @@ func (tun *NativeTun) setMTU(n int) error {
)
if errno != 0 {
return errors.New("Failed to set MTU of TUN device")
return errors.New("failed to set MTU of TUN device")
}
return nil
@@ -260,7 +260,7 @@ func (tun *NativeTun) MTU() (int, error) {
uintptr(unsafe.Pointer(&ifr[0])),
)
if errno != 0 {
return 0, errors.New("Failed to get MTU of TUN device: " + strconv.FormatInt(int64(errno), 10))
return 0, errors.New("failed to get MTU of TUN device: " + strconv.FormatInt(int64(errno), 10))
}
// convert result to signed 32-bit int
@@ -282,7 +282,7 @@ func (tun *NativeTun) Name() (string, error) {
uintptr(unsafe.Pointer(&ifr[0])),
)
if errno != 0 {
return "", errors.New("Failed to get name of TUN device: " + strconv.FormatInt(int64(errno), 10))
return "", errors.New("failed to get name of TUN device: " + strconv.FormatInt(int64(errno), 10))
}
nullStr := ifr[:]
i := bytes.IndexByte(nullStr, 0)