Fix regression in 330701d causing register to no longe rwork

pull/173/head
James Mills 5 months ago
parent cea7e7fcf6
commit 8a18428b87
Signed by: prologic
GPG Key ID: AC4C014F1440EBD6
  1. 10
      client.go

@ -131,17 +131,13 @@ func NewClient(me *Addr, options ...ClientOption) (*Client, error) {
}
if err := cli.me.Refresh(); err != nil {
log.WithError(err).Warn("error looking up user endpoint")
log.WithError(err).Debug("error looking up user endpoint")
}
if cli.me == nil || cli.me.IsZero() {
return nil, fmt.Errorf("unable to find your user address in %s", cli.id.Source())
}
if cli.me.Endpoint() == nil {
return nil, fmt.Errorf("unable to find your endpoint for %s", cli.me.String())
}
log.Debugf("Using identity %s with public key %s", cli.id.Source(), cli.id.key)
log.Debugf("Salty Addr is %s", cli.me)
log.Debugf("Endpoint is %s", cli.me.Endpoint())
@ -380,6 +376,10 @@ func (cli *Client) Lookup(user string) (*Addr, error) {
// Send sends an encrypted message to the specified user
func (cli *Client) Send(user, msg string) error {
if cli.me.Endpoint() == nil {
return fmt.Errorf("unable to find your endpoint for %s", cli.me.String())
}
addr, err := cli.getAddr(user)
if err != nil {
return fmt.Errorf("error looking up user %s: %w", user, err)

Loading…
Cancel
Save