mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2025-06-14 18:36:07 +00:00
Searches called from api.go, various other tweaks, searches now have a callback for success/failure, node ID now reported by admin socket
This commit is contained in:
@ -10,6 +10,7 @@ import (
|
||||
"os/signal"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"golang.org/x/text/encoding/unicode"
|
||||
|
||||
@ -267,6 +268,18 @@ func main() {
|
||||
defer func() {
|
||||
n.core.Stop()
|
||||
}()
|
||||
// Some stuff
|
||||
go func() {
|
||||
time.Sleep(time.Second * 2)
|
||||
session, err := n.core.Dial("nodeid", "babd4e4bccb216f77bb723c1b034b63a652060aabfe9506b51f687183e9b0fd13f438876f5a3ab21cac9c8101eb88e2613fe2a8b0724add09d7ef5a72146c31f")
|
||||
logger.Println(session, err)
|
||||
b := []byte{1, 2, 3, 4, 5}
|
||||
for {
|
||||
logger.Println(session.Write(b))
|
||||
logger.Println(session.Read(b))
|
||||
time.Sleep(time.Second)
|
||||
}
|
||||
}()
|
||||
// Make some nice output that tells us what our IPv6 address and subnet are.
|
||||
// This is just logged to stdout for the user.
|
||||
address := n.core.Address()
|
||||
|
@ -277,6 +277,9 @@ func main() {
|
||||
fmt.Println("Coords:", coords)
|
||||
}
|
||||
if *verbose {
|
||||
if nodeID, ok := v.(map[string]interface{})["node_id"].(string); ok {
|
||||
fmt.Println("Node ID:", nodeID)
|
||||
}
|
||||
if boxPubKey, ok := v.(map[string]interface{})["box_pub_key"].(string); ok {
|
||||
fmt.Println("Public encryption key:", boxPubKey)
|
||||
}
|
||||
|
Reference in New Issue
Block a user