1
0
mirror of https://github.com/fumiama/WireGold.git synced 2026-06-10 11:40:30 +08:00
Files
WireGold/gold/p2p/udp/init.go
2024-07-16 21:38:45 +09:00

22 lines
360 B
Go

package udp
import (
"net"
"net/netip"
"github.com/fumiama/WireGold/gold/p2p"
)
func NewEndpoint(endpoint string, _ ...any) p2p.EndPoint {
return (*EndPoint)(net.UDPAddrFromAddrPort(
netip.MustParseAddrPort(endpoint),
))
}
func init() {
_, hasexist := p2p.Register("udp", NewEndpoint)
if hasexist {
panic("network udp has been registered")
}
}