1
0
mirror of https://github.com/fumiama/WireGold.git synced 2026-06-05 07:50:24 +08:00

fix: listen at print

This commit is contained in:
源文雨
2023-08-04 17:22:32 +08:00
parent 6f75de6b95
commit a90eea8d4b
2 changed files with 4 additions and 2 deletions

View File

@@ -4,6 +4,7 @@ import (
"bytes"
"io"
"net"
"net/netip"
"runtime"
"strconv"
"sync"
@@ -18,10 +19,11 @@ import (
// 监听本机 endpoint
func (m *Me) listen() (conn *net.UDPConn, err error) {
conn, err = net.ListenUDP("udp", m.myend)
conn, err = net.ListenUDP("udp", net.UDPAddrFromAddrPort(netip.MustParseAddrPort(m.myend.String())))
if err != nil {
return
}
m.myend = conn.LocalAddr()
logrus.Infoln("[listen] at", m.myend)
var mu sync.Mutex
for i := 0; i < runtime.NumCPU()*4; i++ {

View File

@@ -29,7 +29,7 @@ type Me struct {
// 本机子网
subnet net.IPNet
// 本机 endpoint
myend *net.UDPAddr
myend net.Addr
// 本机环回 link
loop *Link
// 本机活跃的所有连接