Skip to content

Commit

Permalink
feat(gossip): remove hostname and public ip in gossip payload
Browse files Browse the repository at this point in the history
Signed-off-by: cardyok <[email protected]>
  • Loading branch information
cardyok committed Aug 21, 2024
1 parent 41a24bf commit bdcda46
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
9 changes: 2 additions & 7 deletions internal/login/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,7 @@ func Login(name string, token string, endpoint string, components string, uid st
return nil
}

func Gossip(name string, endpoint string, uid string, address string) error {
ip, err := PublicIP()
if err != nil {
return fmt.Errorf("failed to fetch public ip: %w", err)
}
func Gossip(endpoint string, uid string, address string) error {
type payload struct {
Name string `json:"name"`
ID string `json:"id"`
Expand All @@ -80,9 +76,8 @@ func Gossip(name string, endpoint string, uid string, address string) error {
Status string `json:"status"`
}
content := payload{
Name: name,
Name: uid,
ID: uid,
PublicIP: ip,
Provider: "personal",
DaemonVersion: version.Version,
}
Expand Down
6 changes: 1 addition & 5 deletions internal/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -851,11 +851,7 @@ func New(ctx context.Context, config *lepconfig.Config, endpoint string) (_ *Ser
}
}()

hostname, err := goOS.Hostname()
if err != nil {
hostname = "UnknownName"
}
if err = login.Gossip(hostname, endpoint, uid, config.Address); err != nil {
if err = login.Gossip(endpoint, uid, config.Address); err != nil {
log.Logger.Errorf("failed to gossip: %v", err)
}
return s, nil
Expand Down

0 comments on commit bdcda46

Please sign in to comment.