/usr/share/gocode/src/github.com/vishvananda/netlink/nl/xfrm_monitor_linux_test.go is in golang-github-vishvananda-netlink-dev 0.0~git20170407.0.1e86b2b-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | package nl
import (
"bytes"
"crypto/rand"
"encoding/binary"
"testing"
)
func (msg *XfrmUserExpire) write(b []byte) {
msg.XfrmUsersaInfo.write(b[0:SizeofXfrmUsersaInfo])
b[SizeofXfrmUsersaInfo] = msg.Hard
copy(b[SizeofXfrmUsersaInfo+1:SizeofXfrmUserExpire], msg.Pad[:])
}
func (msg *XfrmUserExpire) serializeSafe() []byte {
b := make([]byte, SizeofXfrmUserExpire)
msg.write(b)
return b
}
func deserializeXfrmUserExpireSafe(b []byte) *XfrmUserExpire {
var msg = XfrmUserExpire{}
binary.Read(bytes.NewReader(b[0:SizeofXfrmUserExpire]), NativeEndian(), &msg)
return &msg
}
func TestXfrmUserExpireDeserializeSerialize(t *testing.T) {
var orig = make([]byte, SizeofXfrmUserExpire)
rand.Read(orig)
safemsg := deserializeXfrmUserExpireSafe(orig)
msg := DeserializeXfrmUserExpire(orig)
testDeserializeSerialize(t, orig, safemsg, msg)
}
|