fix panic in tun handler
This commit is contained in:
@ -49,6 +49,9 @@ func (h *tunHandler) transportServer(ctx context.Context, tun io.ReadWriter, con
|
||||
if err != nil {
|
||||
return ErrTun
|
||||
}
|
||||
if n == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
var src, dst net.IP
|
||||
if waterutil.IsIPv4((*b)[:n]) {
|
||||
@ -110,6 +113,9 @@ func (h *tunHandler) transportServer(ctx context.Context, tun io.ReadWriter, con
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if n == 0 {
|
||||
return nil
|
||||
}
|
||||
if n > keepAliveHeaderLength && bytes.Equal((*b)[:4], magicHeader) {
|
||||
var peerIPs []net.IP
|
||||
data := (*b)[keepAliveHeaderLength:n]
|
||||
|
Reference in New Issue
Block a user