commit 2f66ffd8201aa31aba279822a292125485bffe51
parent 9d478d3c2b426c24d92be1079ce0ba39acd70e1b
Author: parazyd <parazyd@dyne.org>
Date: Sun, 7 Mar 2021 21:20:14 +0100
Export ValidateOnionInternal function.
Diffstat:
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/announce_test.go b/announce_test.go
@@ -57,7 +57,7 @@ func TestAnnounce(t *testing.T) {
t.Fatal(err)
}
for _, i := range ret {
- if err := validateOnionInternal(i); err != nil {
+ if err := ValidateOnionInternal(i); err != nil {
t.Fatal(err)
}
}
diff --git a/peer_announce.go b/peer_announce.go
@@ -97,7 +97,7 @@ func AppendPeers(p []string) error {
if _, ok := Peers[i]; ok {
continue
}
- if err := validateOnionInternal(i); err != nil {
+ if err := ValidateOnionInternal(i); err != nil {
log.Printf("warning: received garbage peer (%v)", err)
continue
}
diff --git a/rpc_announce.go b/rpc_announce.go
@@ -55,7 +55,7 @@ func (ann) Init(ctx context.Context, vals []string) ([]string, error) {
pubkey := vals[1]
portmap := strings.Split(vals[2], ",")
- if err := validateOnionInternal(onion); err != nil {
+ if err := ValidateOnionInternal(onion); err != nil {
rpcWarn("ann.Init", err.Error())
return nil, err
}
@@ -145,7 +145,7 @@ func (ann) Validate(ctx context.Context, vals []string) ([]string, error) {
onion := vals[0]
signature := vals[1]
- if err := validateOnionInternal(onion); err != nil {
+ if err := ValidateOnionInternal(onion); err != nil {
rpcWarn("ann.Validate", err.Error())
return nil, err
}
diff --git a/sanity.go b/sanity.go
@@ -40,7 +40,7 @@ func ValidateOnionAddress(addr string) error {
return nil
}
-func validateOnionInternal(onionaddr string) error {
+func ValidateOnionInternal(onionaddr string) error {
splitOnion := strings.Split(onionaddr, ":")
if len(splitOnion) != 2 {
return errors.New("onion address doesn't contain a port")