]> Cypherpunks.ru repositories - nncp.git/blobdiff - src/call.go
Various Yggdrasil related refactoring and tcpip network stack
[nncp.git] / src / call.go
index f916a8290646a61d340bbe78dedfb7a65e6d20ec..c4e04cbd9d2a1a47a1e5c5f27a62410b159d0a0c 100644 (file)
@@ -1,6 +1,6 @@
 /*
 NNCP -- Node to Node copy, utilities for store-and-forward data exchange
-Copyright (C) 2016-2021 Sergey Matveev <stargrave@stargrave.org>
+Copyright (C) 2016-2022 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -22,10 +22,12 @@ import (
        "fmt"
        "net"
        "os"
+       "strings"
        "time"
 
        "github.com/dustin/go-humanize"
        "github.com/gorhill/cronexpr"
+       nncpYggdrasil "go.cypherpunks.ru/nncp/v8/yggdrasil"
 )
 
 type Call struct {
@@ -83,11 +85,13 @@ func (ctx *Ctx) CallNode(
                        if addr == "" {
                                addr = UCSPITCPClient
                        }
+               } else if strings.HasPrefix(addr, "yggdrasilc://") {
+                       conn, err = nncpYggdrasil.NewConn(ctx.YggdrasilAliases, addr)
                } else {
                        conn, err = net.Dial("tcp", addr)
                }
                if err != nil {
-                       ctx.LogD("calling", append(les, LE{"Err", err}), func(les LEs) string {
+                       ctx.LogE("calling", les, err, func(les LEs) string {
                                return fmt.Sprintf("Calling %s (%s)", node.Name, addr)
                        })
                        continue