| 99 | } |
| 100 | |
| 101 | func (this *Chain) AddDropIPv4Rule(ip []byte, userData []byte) (*Rule, error) { |
| 102 | return this.AddRule(&RuleOptions{ |
| 103 | Exprs: []expr.Any{ |
| 104 | &expr.Payload{ |
| 105 | DestRegister: 1, |
| 106 | Base: expr.PayloadBaseNetworkHeader, |
| 107 | Offset: 12, |
| 108 | Len: 4, |
| 109 | }, |
| 110 | &expr.Cmp{ |
| 111 | Op: expr.CmpOpEq, |
| 112 | Register: 1, |
| 113 | Data: ip, |
| 114 | }, |
| 115 | &expr.Verdict{ |
| 116 | Kind: expr.VerdictDrop, |
| 117 | }, |
| 118 | }, |
| 119 | UserData: userData, |
| 120 | }) |
| 121 | } |
| 122 | |
| 123 | func (this *Chain) AddDropIPv6Rule(ip []byte, userData []byte) (*Rule, error) { |
| 124 | return this.AddRule(&RuleOptions{ |