MCPcopy Create free account
hub / github.com/google/nftables / marshal

Method marshal

expr/socket.go:51–60  ·  view source on GitHub ↗
(fam byte)

Source from the content-addressed store, hash-verified

49)
50
51func (e *Socket) marshal(fam byte) ([]byte, error) {
52 exprData, err := e.marshalData(fam)
53 if err != nil {
54 return nil, err
55 }
56 return netlink.MarshalAttributes([]netlink.Attribute{
57 {Type: unix.NFTA_EXPR_NAME, Data: []byte("socket\x00")},
58 {Type: unix.NLA_F_NESTED | unix.NFTA_EXPR_DATA, Data: exprData},
59 })
60}
61
62func (e *Socket) marshalData(fam byte) ([]byte, error) {
63 // NOTE: Socket.Level is only used when Socket.Key == SocketKeyCgroupv2. But `nft` always encoding it. Check link below:

Callers

nothing calls this directly

Calls 1

marshalDataMethod · 0.95

Tested by

no test coverage detected