Simplified xplatform spec
This commit is contained in:
parent
eefa47b0f9
commit
012e7b9d33
26
src/uapi.go
26
src/uapi.go
|
@ -124,16 +124,12 @@ func ipcSetOperation(device *Device, socket *bufio.ReadWriter) *IPCError {
|
||||||
switch key {
|
switch key {
|
||||||
case "private_key":
|
case "private_key":
|
||||||
var sk NoisePrivateKey
|
var sk NoisePrivateKey
|
||||||
if value == "" {
|
err := sk.FromHex(value)
|
||||||
device.SetPrivateKey(sk)
|
if err != nil {
|
||||||
} else {
|
logError.Println("Failed to set private_key:", err)
|
||||||
err := sk.FromHex(value)
|
return &IPCError{Code: ipcErrorInvalid}
|
||||||
if err != nil {
|
|
||||||
logError.Println("Failed to set private_key:", err)
|
|
||||||
return &IPCError{Code: ipcErrorInvalid}
|
|
||||||
}
|
|
||||||
device.SetPrivateKey(sk)
|
|
||||||
}
|
}
|
||||||
|
device.SetPrivateKey(sk)
|
||||||
|
|
||||||
case "listen_port":
|
case "listen_port":
|
||||||
port, err := strconv.ParseUint(value, 10, 16)
|
port, err := strconv.ParseUint(value, 10, 16)
|
||||||
|
@ -161,14 +157,10 @@ func ipcSetOperation(device *Device, socket *bufio.ReadWriter) *IPCError {
|
||||||
// TODO: Clear source address of all peers
|
// TODO: Clear source address of all peers
|
||||||
|
|
||||||
case "fwmark":
|
case "fwmark":
|
||||||
var fwmark uint64 = 0
|
fwmark, err := strconv.ParseUint(value, 10, 32)
|
||||||
if value != "" {
|
if err != nil {
|
||||||
var err error
|
logError.Println("Invalid fwmark", err)
|
||||||
fwmark, err = strconv.ParseUint(value, 10, 32)
|
return &IPCError{Code: ipcErrorInvalid}
|
||||||
if err != nil {
|
|
||||||
logError.Println("Invalid fwmark", err)
|
|
||||||
return &IPCError{Code: ipcErrorInvalid}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
device.net.mutex.Lock()
|
device.net.mutex.Lock()
|
||||||
|
|
Loading…
Reference in a new issue