diff options
author | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2017-08-11 16:18:20 +0200 |
---|---|---|
committer | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2017-08-11 16:18:20 +0200 |
commit | a4eff12d7f749c992247579161c4ce9e60e2df47 (patch) | |
tree | 6032dd0a96ced8313d7199e569ab657f3ba91ca7 /src/index.go | |
parent | cba1d6585ab9b12ae3e0897db85675ba452c3f09 (diff) | |
download | wireguard-go-a4eff12d7f749c992247579161c4ce9e60e2df47.tar.gz wireguard-go-a4eff12d7f749c992247579161c4ce9e60e2df47.zip |
Improved receive.go
- Fixed configuration listen-port semantics
- Improved receive.go code for updating listen port
- Updated under load detection, how follows the kernel space implementation
- Fixed trie bug accidentally introduced in last commit
- Added interface name to log (format still subject to change)
- Can now configure the logging level using the LOG_LEVEL variable
- Begin porting netsh.sh tests
- A number of smaller changes
Diffstat (limited to '')
-rw-r--r-- | src/index.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/index.go b/src/index.go index e518b0f..1ba040e 100644 --- a/src/index.go +++ b/src/index.go @@ -2,8 +2,8 @@ package main import ( "crypto/rand" + "encoding/binary" "sync" - "unsafe" ) /* Index=0 is reserved for unset indecies @@ -24,7 +24,8 @@ type IndexTable struct { func randUint32() (uint32, error) { var buff [4]byte _, err := rand.Read(buff[:]) - return *((*uint32)(unsafe.Pointer(&buff))), err + value := binary.LittleEndian.Uint32(buff[:]) + return value, err } func (table *IndexTable) Init() { |