Code: refresh code

This commit is contained in:
yaling888
2021-07-01 22:49:29 +08:00
parent 3ca5d17c40
commit d7732f6ebc
104 changed files with 11329 additions and 136 deletions

View File

@ -10,6 +10,7 @@ type Port struct {
adapter string
port string
isSource bool
network C.NetWork
}
func (p *Port) RuleType() C.RuleType {
@ -38,7 +39,11 @@ func (p *Port) ShouldResolveIP() bool {
return false
}
func NewPort(port string, adapter string, isSource bool) (*Port, error) {
func (p *Port) NetWork() C.NetWork {
return p.network
}
func NewPort(port string, adapter string, isSource bool, network C.NetWork) (*Port, error) {
_, err := strconv.Atoi(port)
if err != nil {
return nil, errPayload
@ -47,5 +52,6 @@ func NewPort(port string, adapter string, isSource bool) (*Port, error) {
adapter: adapter,
port: port,
isSource: isSource,
network: network,
}, nil
}