mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2024-11-26 06:01:37 +00:00
Formatting tweaks in api.go
This commit is contained in:
parent
24f4754f2b
commit
c9554f82be
@ -261,7 +261,7 @@ func BuildVersion() string {
|
|||||||
return buildVersion
|
return buildVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListenConn returns a listener for Yggdrasil session connections.
|
// ConnListen returns a listener for Yggdrasil session connections.
|
||||||
func (c *Core) ConnListen() (*Listener, error) {
|
func (c *Core) ConnListen() (*Listener, error) {
|
||||||
c.sessions.listenerMutex.Lock()
|
c.sessions.listenerMutex.Lock()
|
||||||
defer c.sessions.listenerMutex.Unlock()
|
defer c.sessions.listenerMutex.Unlock()
|
||||||
@ -300,12 +300,12 @@ func (c *Core) TreeID() *crypto.TreeID {
|
|||||||
return crypto.GetTreeID(&c.sigPub)
|
return crypto.GetTreeID(&c.sigPub)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SigPubKey gets the node's signing public key.
|
// SigningPublicKey gets the node's signing public key.
|
||||||
func (c *Core) SigningPublicKey() string {
|
func (c *Core) SigningPublicKey() string {
|
||||||
return hex.EncodeToString(c.sigPub[:])
|
return hex.EncodeToString(c.sigPub[:])
|
||||||
}
|
}
|
||||||
|
|
||||||
// BoxPubKey gets the node's encryption public key.
|
// EncryptionPublicKey gets the node's encryption public key.
|
||||||
func (c *Core) EncryptionPublicKey() string {
|
func (c *Core) EncryptionPublicKey() string {
|
||||||
return hex.EncodeToString(c.boxPub[:])
|
return hex.EncodeToString(c.boxPub[:])
|
||||||
}
|
}
|
||||||
@ -389,7 +389,7 @@ func (c *Core) GetNodeInfo(keyString, coordString string, nocache bool) (NodeInf
|
|||||||
for res := range response {
|
for res := range response {
|
||||||
return *res, nil
|
return *res, nil
|
||||||
}
|
}
|
||||||
return NodeInfoPayload{}, errors.New(fmt.Sprintf("getNodeInfo timeout: %s", keyString))
|
return NodeInfoPayload{}, fmt.Errorf("getNodeInfo timeout: %s", keyString)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetSessionGatekeeper allows you to configure a handler function for deciding
|
// SetSessionGatekeeper allows you to configure a handler function for deciding
|
||||||
@ -475,7 +475,8 @@ func (c *Core) RemoveAllowedEncryptionPublicKey(bstr string) (err error) {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send a DHT ping to the node with the provided key and coords, optionally looking up the specified target NodeID.
|
// DHTPing sends a DHT ping to the node with the provided key and coords,
|
||||||
|
// optionally looking up the specified target NodeID.
|
||||||
func (c *Core) DHTPing(keyString, coordString, targetString string) (DHTRes, error) {
|
func (c *Core) DHTPing(keyString, coordString, targetString string) (DHTRes, error) {
|
||||||
var key crypto.BoxPubKey
|
var key crypto.BoxPubKey
|
||||||
if keyBytes, err := hex.DecodeString(keyString); err != nil {
|
if keyBytes, err := hex.DecodeString(keyString); err != nil {
|
||||||
@ -535,5 +536,5 @@ func (c *Core) DHTPing(keyString, coordString, targetString string) (DHTRes, err
|
|||||||
}
|
}
|
||||||
return r, nil
|
return r, nil
|
||||||
}
|
}
|
||||||
return DHTRes{}, errors.New(fmt.Sprintf("DHT ping timeout: %s", keyString))
|
return DHTRes{}, fmt.Errorf("DHT ping timeout: %s", keyString)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user