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:
@@ -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++ {
|
||||
|
||||
@@ -29,7 +29,7 @@ type Me struct {
|
||||
// 本机子网
|
||||
subnet net.IPNet
|
||||
// 本机 endpoint
|
||||
myend *net.UDPAddr
|
||||
myend net.Addr
|
||||
// 本机环回 link
|
||||
loop *Link
|
||||
// 本机活跃的所有连接
|
||||
|
||||
Reference in New Issue
Block a user