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

fix(p2p): handle error on parsing endpoint

This commit is contained in:
源文雨
2024-07-17 00:10:43 +09:00
parent 7d25f46813
commit 1c665c68fb
5 changed files with 19 additions and 14 deletions

View File

@@ -12,7 +12,7 @@ var (
ErrEndpointTypeMistatch = errors.New("endpoint type mismatch")
)
type Initializer func(endpoint string, configs ...any) EndPoint
type Initializer func(endpoint string, configs ...any) (EndPoint, error)
var factory syncx.Map[string, Initializer]
@@ -32,7 +32,7 @@ func NewEndPoint(network, endpoint string, configs ...any) (EndPoint, error) {
if !ok {
return nil, errors.New("network " + network + " not found")
}
return initializer(endpoint, configs...), nil
return initializer(endpoint, configs...)
}
type Conn interface {