Fixed port endianness
This commit is contained in:
parent
0485c34c8e
commit
892276aa64
4 changed files with 159 additions and 140 deletions
|
|
@ -23,9 +23,10 @@ type Device struct {
|
|||
}
|
||||
net struct {
|
||||
mutex sync.RWMutex
|
||||
bind UDPBind
|
||||
port uint16
|
||||
fwmark uint32
|
||||
bind UDPBind // bind interface
|
||||
port uint16 // listening port
|
||||
fwmark uint32 // mark value (0 = disabled)
|
||||
update *sync.Cond // the bind was updated
|
||||
}
|
||||
mutex sync.RWMutex
|
||||
privateKey NoisePrivateKey
|
||||
|
|
@ -38,8 +39,7 @@ type Device struct {
|
|||
handshake chan QueueHandshakeElement
|
||||
}
|
||||
signal struct {
|
||||
stop chan struct{}
|
||||
updateBind chan struct{}
|
||||
stop chan struct{}
|
||||
}
|
||||
underLoadUntil atomic.Value
|
||||
ratelimiter Ratelimiter
|
||||
|
|
@ -163,6 +163,12 @@ func NewDevice(tun TUNDevice, logLevel int) *Device {
|
|||
|
||||
device.signal.stop = make(chan struct{})
|
||||
|
||||
// prepare net
|
||||
|
||||
device.net.port = 0
|
||||
device.net.bind = nil
|
||||
device.net.update = sync.NewCond(&device.net.mutex)
|
||||
|
||||
// start workers
|
||||
|
||||
for i := 0; i < runtime.NumCPU(); i += 1 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue