1
0
mirror of https://github.com/fumiama/WireGold.git synced 2026-06-28 14:50:26 +08:00

feat(p2p): add ip

This commit is contained in:
源文雨
2024-07-18 02:01:44 +09:00
parent cb2fe9bd21
commit 28c388aca9
11 changed files with 200 additions and 24 deletions

View File

@@ -5,6 +5,7 @@ import (
"net/netip"
"github.com/fumiama/WireGold/gold/p2p"
"github.com/fumiama/WireGold/helper"
)
func NewEndpoint(endpoint string, _ ...any) (p2p.EndPoint, error) {
@@ -16,8 +17,9 @@ func NewEndpoint(endpoint string, _ ...any) (p2p.EndPoint, error) {
}
func init() {
_, hasexist := p2p.Register("udp", NewEndpoint)
name := helper.FolderName()
_, hasexist := p2p.Register(name, NewEndpoint)
if hasexist {
panic("network udp has been registered")
panic("network " + name + " has been registered")
}
}