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

Method marshalData

expr/tproxy.go:53–67  ·  view source on GitHub ↗
(fam byte)

Source from the content-addressed store, hash-verified

51}
52
53func (e *TProxy) marshalData(fam byte) ([]byte, error) {
54 attrs := []netlink.Attribute{
55 {Type: NFTA_TPROXY_FAMILY, Data: binaryutil.BigEndian.PutUint32(uint32(e.Family))},
56 {Type: NFTA_TPROXY_REG_PORT, Data: binaryutil.BigEndian.PutUint32(e.RegPort)},
57 }
58
59 if e.RegAddr != 0 {
60 attrs = append(attrs, netlink.Attribute{
61 Type: NFTA_TPROXY_REG_ADDR,
62 Data: binaryutil.BigEndian.PutUint32(e.RegAddr),
63 })
64 }
65
66 return netlink.MarshalAttributes(attrs)
67}
68
69func (e *TProxy) unmarshal(fam byte, data []byte) error {
70 ad, err := netlink.NewAttributeDecoder(data)

Callers 1

marshalMethod · 0.95

Calls 1

PutUint32Method · 0.65

Tested by

no test coverage detected