github.com/status-im/status-go@v1.1.0/protocol/requests/save_new_waku_node.go (about)

     1  package requests
     2  
     3  import (
     4  	"strings"
     5  
     6  	"github.com/multiformats/go-multiaddr"
     7  )
     8  
     9  type SaveNewWakuNode struct {
    10  	NodeAddress string `json:"nodeAddress"`
    11  }
    12  
    13  func (r *SaveNewWakuNode) Validate() error {
    14  	if strings.HasPrefix(r.NodeAddress, "enrtree://") {
    15  		return nil
    16  	}
    17  
    18  	// It is a normal multiaddress
    19  	_, err := multiaddr.NewMultiaddr(r.NodeAddress)
    20  	if err != nil {
    21  		return err
    22  	}
    23  
    24  	return nil
    25  }