mirror of
https://github.com/SagerNet/sing-tun.git
synced 2025-04-04 20:37:43 +03:00
Minor fixes
This commit is contained in:
parent
575ac29417
commit
c7dd5d457e
2 changed files with 10 additions and 5 deletions
12
system.go
12
system.go
|
@ -51,6 +51,7 @@ func NewSystem(options StackOptions) (Stack, error) {
|
|||
mtu: options.MTU,
|
||||
udpTimeout: options.UDPTimeout,
|
||||
handler: options.Handler,
|
||||
logger: options.Logger,
|
||||
inet4Prefixes: options.Inet4Address,
|
||||
inet6Prefixes: options.Inet6Address,
|
||||
}
|
||||
|
@ -149,11 +150,16 @@ func (s *System) wintunLoop(winTun WinTun) {
|
|||
release()
|
||||
continue
|
||||
}
|
||||
switch packet[0] >> 4 {
|
||||
switch ipVersion := packet[0] >> 4; ipVersion {
|
||||
case 4:
|
||||
s.processIPv4(packet)
|
||||
err = s.processIPv4(packet)
|
||||
case 6:
|
||||
s.processIPv6(packet)
|
||||
err = s.processIPv6(packet)
|
||||
default:
|
||||
err = E.New("ip: unknown version: ", ipVersion)
|
||||
}
|
||||
if err != nil {
|
||||
s.logger.Trace(err)
|
||||
}
|
||||
release()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue