mirror of
https://github.com/apernet/OpenGFW.git
synced 2024-11-15 06:49:24 +08:00
chore: allow set nfqueue num to 0
This commit is contained in:
parent
d3f1785ac9
commit
d8d7c5b477
14
cmd/root.go
14
cmd/root.go
@ -173,13 +173,13 @@ type cliConfig struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type cliConfigIO struct {
|
type cliConfigIO struct {
|
||||||
QueueSize uint32 `mapstructure:"queueSize"`
|
QueueSize uint32 `mapstructure:"queueSize"`
|
||||||
QueueNum uint16 `mapstructure:"queueNum"`
|
QueueNum *uint16 `mapstructure:"queueNum"`
|
||||||
Table string `mapstructure:"table"`
|
Table string `mapstructure:"table"`
|
||||||
ReadBuffer int `mapstructure:"rcvBuf"`
|
ReadBuffer int `mapstructure:"rcvBuf"`
|
||||||
WriteBuffer int `mapstructure:"sndBuf"`
|
WriteBuffer int `mapstructure:"sndBuf"`
|
||||||
Local bool `mapstructure:"local"`
|
Local bool `mapstructure:"local"`
|
||||||
RST bool `mapstructure:"rst"`
|
RST bool `mapstructure:"rst"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type cliConfigReplay struct {
|
type cliConfigReplay struct {
|
||||||
|
@ -110,7 +110,7 @@ type nfqueuePacketIO struct {
|
|||||||
|
|
||||||
type NFQueuePacketIOConfig struct {
|
type NFQueuePacketIOConfig struct {
|
||||||
QueueSize uint32
|
QueueSize uint32
|
||||||
QueueNum uint16
|
QueueNum *uint16
|
||||||
Table string
|
Table string
|
||||||
ReadBuffer int
|
ReadBuffer int
|
||||||
WriteBuffer int
|
WriteBuffer int
|
||||||
@ -122,8 +122,9 @@ func NewNFQueuePacketIO(config NFQueuePacketIOConfig) (PacketIO, error) {
|
|||||||
if config.QueueSize == 0 {
|
if config.QueueSize == 0 {
|
||||||
config.QueueSize = nfqueueDefaultQueueSize
|
config.QueueSize = nfqueueDefaultQueueSize
|
||||||
}
|
}
|
||||||
if config.QueueNum == 0 {
|
if config.QueueNum == nil {
|
||||||
config.QueueNum = nfqueueDefaultQueueNum
|
queueNum := uint16(nfqueueDefaultQueueNum)
|
||||||
|
config.QueueNum = &queueNum
|
||||||
}
|
}
|
||||||
if config.Table == "" {
|
if config.Table == "" {
|
||||||
config.Table = nftDefaultTable
|
config.Table = nftDefaultTable
|
||||||
@ -142,7 +143,7 @@ func NewNFQueuePacketIO(config NFQueuePacketIOConfig) (PacketIO, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
n, err := nfqueue.Open(&nfqueue.Config{
|
n, err := nfqueue.Open(&nfqueue.Config{
|
||||||
NfQueue: config.QueueNum,
|
NfQueue: *config.QueueNum,
|
||||||
MaxPacketLen: nfqueueMaxPacketLen,
|
MaxPacketLen: nfqueueMaxPacketLen,
|
||||||
MaxQueueLen: config.QueueSize,
|
MaxQueueLen: config.QueueSize,
|
||||||
Copymode: nfqueue.NfQnlCopyPacket,
|
Copymode: nfqueue.NfQnlCopyPacket,
|
||||||
@ -169,7 +170,7 @@ func NewNFQueuePacketIO(config NFQueuePacketIOConfig) (PacketIO, error) {
|
|||||||
n: n,
|
n: n,
|
||||||
local: config.Local,
|
local: config.Local,
|
||||||
rst: config.RST,
|
rst: config.RST,
|
||||||
queueNum: int(config.QueueNum),
|
queueNum: int(*config.QueueNum),
|
||||||
table: config.Table,
|
table: config.Table,
|
||||||
ipt4: ipt4,
|
ipt4: ipt4,
|
||||||
ipt6: ipt6,
|
ipt6: ipt6,
|
||||||
|
Loading…
Reference in New Issue
Block a user