mirror of
https://github.com/fosrl/newt.git
synced 2026-02-08 05:56:40 +00:00
quiet and logs and fix ios errors
This commit is contained in:
@@ -523,7 +523,7 @@ func (b *SharedBind) receiveIPv4Simple(conn *net.UDPConn, bufs [][]byte, sizes [
|
|||||||
func (b *SharedBind) handleMagicPacket(data []byte, addr *net.UDPAddr) bool {
|
func (b *SharedBind) handleMagicPacket(data []byte, addr *net.UDPAddr) bool {
|
||||||
// Check if this is a test request packet
|
// Check if this is a test request packet
|
||||||
if len(data) >= MagicTestRequestLen && bytes.HasPrefix(data, MagicTestRequest) {
|
if len(data) >= MagicTestRequestLen && bytes.HasPrefix(data, MagicTestRequest) {
|
||||||
logger.Debug("Received magic test REQUEST from %s, sending response", addr.String())
|
// logger.Debug("Received magic test REQUEST from %s, sending response", addr.String())
|
||||||
// Extract the random data portion to echo back
|
// Extract the random data portion to echo back
|
||||||
echoData := data[len(MagicTestRequest) : len(MagicTestRequest)+MagicPacketDataLen]
|
echoData := data[len(MagicTestRequest) : len(MagicTestRequest)+MagicPacketDataLen]
|
||||||
|
|
||||||
@@ -546,7 +546,7 @@ func (b *SharedBind) handleMagicPacket(data []byte, addr *net.UDPAddr) bool {
|
|||||||
|
|
||||||
// Check if this is a test response packet
|
// Check if this is a test response packet
|
||||||
if len(data) >= MagicTestResponseLen && bytes.HasPrefix(data, MagicTestResponse) {
|
if len(data) >= MagicTestResponseLen && bytes.HasPrefix(data, MagicTestResponse) {
|
||||||
logger.Debug("Received magic test RESPONSE from %s", addr.String())
|
// logger.Debug("Received magic test RESPONSE from %s", addr.String())
|
||||||
// Extract the echoed data
|
// Extract the echoed data
|
||||||
echoData := data[len(MagicTestResponse) : len(MagicTestResponse)+MagicPacketDataLen]
|
echoData := data[len(MagicTestResponse) : len(MagicTestResponse)+MagicPacketDataLen]
|
||||||
|
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ func (t *HolepunchTester) Stop() {
|
|||||||
|
|
||||||
// handleResponse is called by SharedBind when a magic response is received
|
// handleResponse is called by SharedBind when a magic response is received
|
||||||
func (t *HolepunchTester) handleResponse(addr netip.AddrPort, echoData []byte) {
|
func (t *HolepunchTester) handleResponse(addr netip.AddrPort, echoData []byte) {
|
||||||
logger.Debug("Received magic response from %s", addr.String())
|
// logger.Debug("Received magic response from %s", addr.String())
|
||||||
key := string(echoData)
|
key := string(echoData)
|
||||||
|
|
||||||
value, ok := t.pendingRequests.LoadAndDelete(key)
|
value, ok := t.pendingRequests.LoadAndDelete(key)
|
||||||
@@ -152,7 +152,7 @@ func (t *HolepunchTester) handleResponse(addr netip.AddrPort, echoData []byte) {
|
|||||||
|
|
||||||
req := value.(*pendingRequest)
|
req := value.(*pendingRequest)
|
||||||
rtt := time.Since(req.sentAt)
|
rtt := time.Since(req.sentAt)
|
||||||
logger.Debug("Magic response matched pending request for %s (RTT: %v)", req.endpoint, rtt)
|
// logger.Debug("Magic response matched pending request for %s (RTT: %v)", req.endpoint, rtt)
|
||||||
|
|
||||||
// Send RTT to the waiting goroutine (non-blocking)
|
// Send RTT to the waiting goroutine (non-blocking)
|
||||||
select {
|
select {
|
||||||
|
|||||||
@@ -44,9 +44,9 @@ func ConfigureInterface(interfaceName string, tunnelIp string, mtu int) error {
|
|||||||
return configureDarwin(interfaceName, ip, ipNet)
|
return configureDarwin(interfaceName, ip, ipNet)
|
||||||
case "windows":
|
case "windows":
|
||||||
return configureWindows(interfaceName, ip, ipNet)
|
return configureWindows(interfaceName, ip, ipNet)
|
||||||
default:
|
|
||||||
return fmt.Errorf("unsupported operating system: %s", runtime.GOOS)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// waitForInterfaceUp polls the network interface until it's up or times out
|
// waitForInterfaceUp polls the network interface until it's up or times out
|
||||||
|
|||||||
Reference in New Issue
Block a user