[skip ci][内容]

1.修复部分空指针问题
2.修改go.mod
This commit is contained in:
MetaCubeX
2022-03-19 22:27:22 +08:00
parent e67f94b87a
commit 2d1c031ce0
8 changed files with 32 additions and 19 deletions

View File

@@ -13,20 +13,22 @@ type NetworkType struct {
}
func NewNetworkType(network, adapter string) (*NetworkType, error) {
ntType := new(NetworkType)
ntType.adapter = adapter
var netType C.NetWork
switch strings.ToUpper(network) {
case "TCP":
ntType.network = C.TCP
netType = C.TCP
break
case "UDP":
ntType.network = C.UDP
netType = C.UDP
break
default:
return nil, fmt.Errorf("unsupported network type, only TCP/UDP")
}
return ntType, nil
return &NetworkType{
Base: &Base{},
network: netType,
adapter: adapter,
}, nil
}
func (n *NetworkType) RuleType() C.RuleType {