misc: small fix or general refactoring i did not bother commenting

This commit is contained in:
evilsocket 2018-04-10 14:25:02 +02:00
parent 6803808137
commit 026d2fad6f
Failed to generate hash of commit
2 changed files with 6 additions and 6 deletions

View file

@ -31,7 +31,7 @@ const (
NF_REPEAT Verdict = 4
NF_STOP Verdict = 5
NF_DEFAULT_QUEUE_SIZE uint32 = 0xffff
NF_DEFAULT_QUEUE_SIZE uint32 = 4096
NF_DEFAULT_PACKET_SIZE uint32 = 4096
ipv4version = 0x40

View file

@ -45,7 +45,7 @@ func NewOperator(t Type, o Operand, data string) Operator {
Operand: o,
Data: data,
}
op.Compile()
op.compile()
return op
}
@ -54,13 +54,13 @@ func (o *Operator) UnmarshalJSON(b []byte) error {
if err != nil {
return err
}
// make sure it's ready to be used
o.Compile()
// make sure it's ready to be used after being
// deserialized from a json rule file
o.compile()
return nil
}
func (o *Operator) Compile() {
func (o *Operator) compile() {
if o.Type == Simple {
o.cb = o.simpleCmp
} else if o.Type == Regexp {