diff --git a/client/internal/peer/conn.go b/client/internal/peer/conn.go index e60089cb6..7c99ae15a 100644 --- a/client/internal/peer/conn.go +++ b/client/internal/peer/conn.go @@ -333,10 +333,11 @@ func (conn *Conn) iCEConnectionIsReady(priority ConnPriority, iceConnInfo ICECon ep = wgProxy.EndpointAddr() conn.wgProxyICE = wgProxy } else { - log.Infof("direct iceConnInfo: %v", iceConnInfo.RemoteConn) + conn.log.Infof("direct iceConnInfo: %v", iceConnInfo.RemoteConn) + nilCheck(conn.log, iceConnInfo.RemoteConn) directEp, err := net.ResolveUDPAddr("udp", iceConnInfo.RemoteConn.RemoteAddr().String()) if err != nil { - log.Errorf("failed to resolveUDPaddr") + conn.log.Errorf("failed to resolveUDPaddr") conn.handleConfigurationFailure(err, nil) return } diff --git a/client/internal/peer/nilcheck.go b/client/internal/peer/nilcheck.go new file mode 100644 index 000000000..5d2018ac4 --- /dev/null +++ b/client/internal/peer/nilcheck.go @@ -0,0 +1,23 @@ +package peer + +import ( + "net" + "reflect" + + log "github.com/sirupsen/logrus" +) + +func nilCheck(log *log.Entry, conn net.Conn) { + if conn == nil { + log.Infof("conn is nil") + return + } + + if conn.RemoteAddr() == nil { + log.Infof("conn.RemoteAddr() is nil") + } + + if reflect.ValueOf(conn.RemoteAddr()).IsNil() { + log.Infof("value of conn.RemoteAddr() is nil") + } +} diff --git a/client/internal/peer/worker_ice.go b/client/internal/peer/worker_ice.go index 674fef469..eebcdfd31 100644 --- a/client/internal/peer/worker_ice.go +++ b/client/internal/peer/worker_ice.go @@ -128,6 +128,7 @@ func (w *WorkerICE) OnNewOffer(remoteOfferAnswer *OfferAnswer) { } w.log.Infof("check remoteConn: %v", remoteConn) w.log.Infof("check remoteConn.RemoteAddr: %v", remoteConn.RemoteAddr()) + nilCheck(w.log, remoteConn) w.log.Debugf("agent dial succeeded") pair, err := w.agent.GetSelectedCandidatePair()