mirror of
https://github.com/status-im/status-go.git
synced 2025-01-09 06:12:55 +00:00
fe25d97052
* add waku nodeaddr and max log backups validation * Allow to set new waku node * Allow to set custom max backups * add tests
26 lines
400 B
Go
26 lines
400 B
Go
package requests
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/multiformats/go-multiaddr"
|
|
)
|
|
|
|
type SaveNewWakuNode struct {
|
|
NodeAddress string `json:"nodeAddress"`
|
|
}
|
|
|
|
func (r *SaveNewWakuNode) Validate() error {
|
|
if strings.HasPrefix(r.NodeAddress, "enrtree://") {
|
|
return nil
|
|
}
|
|
|
|
// It is a normal multiaddress
|
|
_, err := multiaddr.NewMultiaddr(r.NodeAddress)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|