mirror of
https://github.com/yggdrasil-network/yggdrasil-go
synced 2024-11-09 15:10:26 +03:00
Minor Fixes (#1107)
* Minor comment fixes. * Optimize PeerEntry for memory efficiency * Improve NodeConfig for memory alignment
This commit is contained in:
parent
5da1fbe397
commit
f56f9c124c
@ -188,7 +188,7 @@ func main() {
|
|||||||
|
|
||||||
n := &node{}
|
n := &node{}
|
||||||
|
|
||||||
// Setup the Yggdrasil node itself.
|
// Set up the Yggdrasil node itself.
|
||||||
{
|
{
|
||||||
options := []core.SetupOption{
|
options := []core.SetupOption{
|
||||||
core.NodeInfo(cfg.NodeInfo),
|
core.NodeInfo(cfg.NodeInfo),
|
||||||
@ -221,7 +221,7 @@ func main() {
|
|||||||
logger.Printf("Your IPv6 subnet is %s", subnet.String())
|
logger.Printf("Your IPv6 subnet is %s", subnet.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup the admin socket.
|
// Set up the admin socket.
|
||||||
{
|
{
|
||||||
options := []admin.SetupOption{
|
options := []admin.SetupOption{
|
||||||
admin.ListenAddress(cfg.AdminListen),
|
admin.ListenAddress(cfg.AdminListen),
|
||||||
@ -237,7 +237,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup the multicast module.
|
// Set up the multicast module.
|
||||||
{
|
{
|
||||||
options := []multicast.SetupOption{}
|
options := []multicast.SetupOption{}
|
||||||
for _, intf := range cfg.MulticastInterfaces {
|
for _, intf := range cfg.MulticastInterfaces {
|
||||||
@ -258,7 +258,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup the TUN module.
|
// Set up the TUN module.
|
||||||
{
|
{
|
||||||
options := []tun.SetupOption{
|
options := []tun.SetupOption{
|
||||||
tun.InterfaceName(cfg.IfName),
|
tun.InterfaceName(cfg.IfName),
|
||||||
|
@ -53,7 +53,7 @@ func (m *Yggdrasil) StartJSON(configjson []byte) error {
|
|||||||
if err := m.config.UnmarshalHJSON(configjson); err != nil {
|
if err := m.config.UnmarshalHJSON(configjson); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// Setup the Yggdrasil node itself.
|
// Set up the Yggdrasil node itself.
|
||||||
{
|
{
|
||||||
options := []core.SetupOption{}
|
options := []core.SetupOption{}
|
||||||
for _, peer := range m.config.Peers {
|
for _, peer := range m.config.Peers {
|
||||||
@ -85,7 +85,7 @@ func (m *Yggdrasil) StartJSON(configjson []byte) error {
|
|||||||
logger.Infof("Your IPv6 subnet is %s", subnet.String())
|
logger.Infof("Your IPv6 subnet is %s", subnet.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup the multicast module.
|
// Set up the multicast module.
|
||||||
if len(m.config.MulticastInterfaces) > 0 {
|
if len(m.config.MulticastInterfaces) > 0 {
|
||||||
var err error
|
var err error
|
||||||
logger.Infof("Initializing multicast %s", "")
|
logger.Infof("Initializing multicast %s", "")
|
||||||
|
@ -27,8 +27,8 @@ type PeerEntry struct {
|
|||||||
RXBytes DataUnit `json:"bytes_recvd,omitempty"`
|
RXBytes DataUnit `json:"bytes_recvd,omitempty"`
|
||||||
TXBytes DataUnit `json:"bytes_sent,omitempty"`
|
TXBytes DataUnit `json:"bytes_sent,omitempty"`
|
||||||
Uptime float64 `json:"uptime,omitempty"`
|
Uptime float64 `json:"uptime,omitempty"`
|
||||||
LastError string `json:"last_error,omitempty"`
|
|
||||||
LastErrorTime time.Duration `json:"last_error_time,omitempty"`
|
LastErrorTime time.Duration `json:"last_error_time,omitempty"`
|
||||||
|
LastError string `json:"last_error,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *AdminSocket) getPeersHandler(req *GetPeersRequest, res *GetPeersResponse) error {
|
func (a *AdminSocket) getPeersHandler(req *GetPeersRequest, res *GetPeersResponse) error {
|
||||||
|
@ -51,9 +51,9 @@ type NodeConfig struct {
|
|||||||
AllowedPublicKeys []string `comment:"List of peer public keys to allow incoming peering connections\nfrom. If left empty/undefined then all connections will be allowed\nby default. This does not affect outgoing peerings, nor does it\naffect link-local peers discovered via multicast."`
|
AllowedPublicKeys []string `comment:"List of peer public keys to allow incoming peering connections\nfrom. If left empty/undefined then all connections will be allowed\nby default. This does not affect outgoing peerings, nor does it\naffect link-local peers discovered via multicast."`
|
||||||
IfName string `comment:"Local network interface name for TUN adapter, or \"auto\" to select\nan interface automatically, or \"none\" to run without TUN."`
|
IfName string `comment:"Local network interface name for TUN adapter, or \"auto\" to select\nan interface automatically, or \"none\" to run without TUN."`
|
||||||
IfMTU uint64 `comment:"Maximum Transmission Unit (MTU) size for your local TUN interface.\nDefault is the largest supported size for your platform. The lowest\npossible value is 1280."`
|
IfMTU uint64 `comment:"Maximum Transmission Unit (MTU) size for your local TUN interface.\nDefault is the largest supported size for your platform. The lowest\npossible value is 1280."`
|
||||||
|
LogLookups bool `json:",omitempty"`
|
||||||
NodeInfoPrivacy bool `comment:"By default, nodeinfo contains some defaults including the platform,\narchitecture and Yggdrasil version. These can help when surveying\nthe network and diagnosing network routing problems. Enabling\nnodeinfo privacy prevents this, so that only items specified in\n\"NodeInfo\" are sent back if specified."`
|
NodeInfoPrivacy bool `comment:"By default, nodeinfo contains some defaults including the platform,\narchitecture and Yggdrasil version. These can help when surveying\nthe network and diagnosing network routing problems. Enabling\nnodeinfo privacy prevents this, so that only items specified in\n\"NodeInfo\" are sent back if specified."`
|
||||||
NodeInfo map[string]interface{} `comment:"Optional node info. This must be a { \"key\": \"value\", ... } map\nor set as null. This is entirely optional but, if set, is visible\nto the whole network on request."`
|
NodeInfo map[string]interface{} `comment:"Optional node info. This must be a { \"key\": \"value\", ... } map\nor set as null. This is entirely optional but, if set, is visible\nto the whole network on request."`
|
||||||
LogLookups bool `json:",omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type MulticastInterfaceConfig struct {
|
type MulticastInterfaceConfig struct {
|
||||||
|
@ -63,7 +63,7 @@ type link struct {
|
|||||||
// The remaining fields can only be modified safely from within the links actor
|
// The remaining fields can only be modified safely from within the links actor
|
||||||
_conn *linkConn // Connected link, if any, nil if not connected
|
_conn *linkConn // Connected link, if any, nil if not connected
|
||||||
_err error // Last error on the connection, if any
|
_err error // Last error on the connection, if any
|
||||||
_errtime time.Time // Last time an error occured
|
_errtime time.Time // Last time an error occurred
|
||||||
}
|
}
|
||||||
|
|
||||||
type linkOptions struct {
|
type linkOptions struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user