-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into rename
- Loading branch information
Showing
27 changed files
with
490 additions
and
351 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright (C) 2024, Ava Labs, Inc. All rights reserved. | ||
// See the file LICENSE for licensing terms. | ||
|
||
package config | ||
|
||
import ( | ||
"net/netip" | ||
|
||
"github.com/ava-labs/avalanchego/ids" | ||
) | ||
|
||
type PeerConfig struct { | ||
ID string `mapstructure:"id" json:"id"` | ||
IP string `mapstructure:"ip" json:"ip"` | ||
|
||
id ids.NodeID | ||
ip netip.AddrPort | ||
} | ||
|
||
func (c *PeerConfig) Validate() error { | ||
var ( | ||
id ids.NodeID | ||
ip netip.AddrPort | ||
err error | ||
) | ||
if id, err = ids.NodeIDFromString(c.ID); err != nil { | ||
return err | ||
} | ||
if ip, err = netip.ParseAddrPort(c.IP); err != nil { | ||
return err | ||
} | ||
c.id = id | ||
c.ip = ip | ||
|
||
return nil | ||
} | ||
|
||
func (c *PeerConfig) GetID() ids.NodeID { | ||
return c.id | ||
} | ||
|
||
func (c *PeerConfig) GetIP() netip.AddrPort { | ||
return c.ip | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.