mirror of
https://github.com/fumiama/WireGold.git
synced 2026-06-10 11:40:30 +08:00
22 lines
360 B
Go
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")
|
|
}
|
|
}
|