1
0
mirror of https://github.com/fumiama/WireGold.git synced 2026-06-27 06:10:26 +08:00

fix(nat): panic on nil endpoint

This commit is contained in:
源文雨
2025-02-22 20:29:49 +09:00
parent a205d889ca
commit 85a90aeb86
3 changed files with 8 additions and 5 deletions

View File

@@ -9,6 +9,7 @@ import (
"fmt"
"io"
"math/rand"
"reflect"
"github.com/klauspost/compress/zstd"
"github.com/sirupsen/logrus"
@@ -123,7 +124,7 @@ func (l *Link) write(p *head.Packet, teatype uint8, additional uint16, datasz ui
// write 向 peer 发一个包
func (l *Link) writeonce(p *head.Packet, teatype uint8, additional uint16, datasz uint32, offset uint16, istransfer, hasmore bool, seq uint32) (int, error) {
peerep := l.endpoint
if peerep == nil {
if reflect.ValueOf(peerep).IsZero() {
return 0, errors.New("nil endpoint of " + p.Dst.String())
}