| 51 | } |
| 52 | |
| 53 | func (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 | |
| 69 | func (e *TProxy) unmarshal(fam byte, data []byte) error { |
| 70 | ad, err := netlink.NewAttributeDecoder(data) |