| 143 | } |
| 144 | |
| 145 | func (this *Chain) AddRejectIPv4Rule(ip []byte, userData []byte) (*Rule, error) { |
| 146 | return this.AddRule(&RuleOptions{ |
| 147 | Exprs: []expr.Any{ |
| 148 | &expr.Payload{ |
| 149 | DestRegister: 1, |
| 150 | Base: expr.PayloadBaseNetworkHeader, |
| 151 | Offset: 12, |
| 152 | Len: 4, |
| 153 | }, |
| 154 | &expr.Cmp{ |
| 155 | Op: expr.CmpOpEq, |
| 156 | Register: 1, |
| 157 | Data: ip, |
| 158 | }, |
| 159 | &expr.Reject{}, |
| 160 | }, |
| 161 | UserData: userData, |
| 162 | }) |
| 163 | } |
| 164 | |
| 165 | func (this *Chain) AddRejectIPv6Rule(ip []byte, userData []byte) (*Rule, error) { |
| 166 | return this.AddRule(&RuleOptions{ |