libwg-go: do not mix C style and Go style variable names
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
e7fd53b809
commit
3eb6c91c9e
@ -60,7 +60,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//export wgTurnOn
|
//export wgTurnOn
|
||||||
func wgTurnOn(ifnameRef string, tun_fd int32, settings string) int32 {
|
func wgTurnOn(ifnameRef string, tunFd int32, settings string) int32 {
|
||||||
interfaceName := string([]byte(ifnameRef))
|
interfaceName := string([]byte(ifnameRef))
|
||||||
|
|
||||||
logger := &Logger{
|
logger := &Logger{
|
||||||
@ -71,9 +71,9 @@ func wgTurnOn(ifnameRef string, tun_fd int32, settings string) int32 {
|
|||||||
|
|
||||||
logger.Debug.Println("Debug log enabled")
|
logger.Debug.Println("Debug log enabled")
|
||||||
|
|
||||||
tun, name, err := tun.CreateTUNFromFD(int(tun_fd))
|
tun, name, err := tun.CreateTUNFromFD(int(tunFd))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
unix.Close(int(tun_fd))
|
unix.Close(int(tunFd))
|
||||||
logger.Error.Println(err)
|
logger.Error.Println(err)
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
@ -86,7 +86,7 @@ func wgTurnOn(ifnameRef string, tun_fd int32, settings string) int32 {
|
|||||||
bufferedSettings := bufio.NewReadWriter(bufio.NewReader(strings.NewReader(settings)), bufio.NewWriter(ioutil.Discard))
|
bufferedSettings := bufio.NewReadWriter(bufio.NewReader(strings.NewReader(settings)), bufio.NewWriter(ioutil.Discard))
|
||||||
setError := ipcSetOperation(device, bufferedSettings)
|
setError := ipcSetOperation(device, bufferedSettings)
|
||||||
if setError != nil {
|
if setError != nil {
|
||||||
unix.Close(int(tun_fd))
|
unix.Close(int(tunFd))
|
||||||
logger.Error.Println(setError)
|
logger.Error.Println(setError)
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
@ -124,7 +124,7 @@ func wgTurnOn(ifnameRef string, tun_fd int32, settings string) int32 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if i == math.MaxInt32 {
|
if i == math.MaxInt32 {
|
||||||
unix.Close(int(tun_fd))
|
unix.Close(int(tunFd))
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
tunnelHandles[i] = TunnelHandle{device: device, uapi: uapi}
|
tunnelHandles[i] = TunnelHandle{device: device, uapi: uapi}
|
||||||
|
@ -10,8 +10,8 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
func CreateTUNFromFD(tun_fd int) (TUNDevice, string, error) {
|
func CreateTUNFromFD(tunFd int) (TUNDevice, string, error) {
|
||||||
file := os.NewFile(uintptr(tun_fd), "/dev/tun")
|
file := os.NewFile(uintptr(tunFd), "/dev/tun")
|
||||||
tun := &nativeTun{
|
tun := &nativeTun{
|
||||||
tunFile: file,
|
tunFile: file,
|
||||||
fd: file.Fd(),
|
fd: file.Fd(),
|
||||||
@ -20,7 +20,7 @@ func CreateTUNFromFD(tun_fd int) (TUNDevice, string, error) {
|
|||||||
nopi: true,
|
nopi: true,
|
||||||
}
|
}
|
||||||
var err error
|
var err error
|
||||||
tun.fdCancel, err = rwcancel.NewRWCancel(tun_fd)
|
tun.fdCancel, err = rwcancel.NewRWCancel(tunFd)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, "", err
|
return nil, "", err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user