From 018f35d9a2c2971e5dbdfe4312224d2ce15367fd Mon Sep 17 00:00:00 2001 From: Arceliar Date: Sun, 23 May 2021 14:42:26 -0500 Subject: [PATCH] rename src/yggdrasil to src/core --- cmd/yggdrasil/main.go | 4 ++-- src/admin/admin.go | 6 +++--- src/{yggdrasil => core}/api.go | 2 +- src/{yggdrasil => core}/core.go | 2 +- src/{yggdrasil => core}/core_test.go | 2 +- src/{yggdrasil => core}/debug.go | 2 +- src/{yggdrasil => core}/doc.go | 8 ++++---- src/{yggdrasil => core}/link.go | 2 +- src/{yggdrasil => core}/tcp.go | 2 +- src/{yggdrasil => core}/tcp_darwin.go | 2 +- src/{yggdrasil => core}/tcp_linux.go | 2 +- src/{yggdrasil => core}/tcp_other.go | 2 +- src/{yggdrasil => core}/tls.go | 2 +- src/{yggdrasil => core}/version.go | 2 +- src/module/module.go | 4 ++-- src/multicast/multicast.go | 8 ++++---- src/tuntap/tun.go | 6 +++--- 17 files changed, 29 insertions(+), 29 deletions(-) rename src/{yggdrasil => core}/api.go (99%) rename src/{yggdrasil => core}/core.go (99%) rename src/{yggdrasil => core}/core_test.go (99%) rename src/{yggdrasil => core}/debug.go (97%) rename src/{yggdrasil => core}/doc.go (96%) rename src/{yggdrasil => core}/link.go (99%) rename src/{yggdrasil => core}/tcp.go (99%) rename src/{yggdrasil => core}/tcp_darwin.go (97%) rename src/{yggdrasil => core}/tcp_linux.go (98%) rename src/{yggdrasil => core}/tcp_other.go (94%) rename src/{yggdrasil => core}/tls.go (99%) rename src/{yggdrasil => core}/version.go (99%) diff --git a/cmd/yggdrasil/main.go b/cmd/yggdrasil/main.go index 0ffad89d..e0d79fc4 100644 --- a/cmd/yggdrasil/main.go +++ b/cmd/yggdrasil/main.go @@ -26,15 +26,15 @@ import ( "github.com/yggdrasil-network/yggdrasil-go/src/admin" "github.com/yggdrasil-network/yggdrasil-go/src/config" + "github.com/yggdrasil-network/yggdrasil-go/src/core" "github.com/yggdrasil-network/yggdrasil-go/src/module" "github.com/yggdrasil-network/yggdrasil-go/src/multicast" "github.com/yggdrasil-network/yggdrasil-go/src/tuntap" "github.com/yggdrasil-network/yggdrasil-go/src/version" - "github.com/yggdrasil-network/yggdrasil-go/src/yggdrasil" ) type node struct { - core yggdrasil.Core + core core.Core state *config.NodeState tuntap module.Module // tuntap.TunAdapter multicast module.Module // multicast.Multicast diff --git a/src/admin/admin.go b/src/admin/admin.go index c82d705d..d2e066a3 100644 --- a/src/admin/admin.go +++ b/src/admin/admin.go @@ -14,13 +14,13 @@ import ( "github.com/gologme/log" "github.com/yggdrasil-network/yggdrasil-go/src/config" - "github.com/yggdrasil-network/yggdrasil-go/src/yggdrasil" + "github.com/yggdrasil-network/yggdrasil-go/src/core" ) // TODO: Add authentication type AdminSocket struct { - core *yggdrasil.Core + core *core.Core log *log.Logger listenaddr string listener net.Listener @@ -63,7 +63,7 @@ func (a *AdminSocket) AddHandler(name string, args []string, handlerfunc func(js } // Init runs the initial admin setup. -func (a *AdminSocket) Init(c *yggdrasil.Core, state *config.NodeState, log *log.Logger, options interface{}) error { +func (a *AdminSocket) Init(c *core.Core, state *config.NodeState, log *log.Logger, options interface{}) error { a.core = c a.log = log a.handlers = make(map[string]handler) diff --git a/src/yggdrasil/api.go b/src/core/api.go similarity index 99% rename from src/yggdrasil/api.go rename to src/core/api.go index 1740e47b..ec03df8d 100644 --- a/src/yggdrasil/api.go +++ b/src/core/api.go @@ -1,4 +1,4 @@ -package yggdrasil +package core import ( "crypto/ed25519" diff --git a/src/yggdrasil/core.go b/src/core/core.go similarity index 99% rename from src/yggdrasil/core.go rename to src/core/core.go index 0d41f711..0adc51b7 100644 --- a/src/yggdrasil/core.go +++ b/src/core/core.go @@ -1,4 +1,4 @@ -package yggdrasil +package core import ( "crypto/ed25519" diff --git a/src/yggdrasil/core_test.go b/src/core/core_test.go similarity index 99% rename from src/yggdrasil/core_test.go rename to src/core/core_test.go index 5f302c23..e1585c3a 100644 --- a/src/yggdrasil/core_test.go +++ b/src/core/core_test.go @@ -1,4 +1,4 @@ -package yggdrasil +package core import ( "bytes" diff --git a/src/yggdrasil/debug.go b/src/core/debug.go similarity index 97% rename from src/yggdrasil/debug.go rename to src/core/debug.go index b9bd5cfb..0fc08259 100644 --- a/src/yggdrasil/debug.go +++ b/src/core/debug.go @@ -1,6 +1,6 @@ // +build debug -package yggdrasil +package core import "fmt" diff --git a/src/yggdrasil/doc.go b/src/core/doc.go similarity index 96% rename from src/yggdrasil/doc.go rename to src/core/doc.go index 9b9dd738..595af229 100644 --- a/src/yggdrasil/doc.go +++ b/src/core/doc.go @@ -1,5 +1,5 @@ /* -Package yggdrasil implements the core functionality of the Yggdrasil Network. +Package core implements the core functionality of the Yggdrasil Network. Introduction @@ -34,11 +34,11 @@ This may look something like this: "os" "github.com/gologme/log" "github.com/yggdrasil-network/yggdrasil-go/src/config" - "github.com/yggdrasil-network/yggdrasil-go/src/yggdrasil" + "github.com/yggdrasil-network/yggdrasil-go/src/core" ) type node struct { - core yggdrasil.Core + core core.Core config *config.NodeConfig log *log.Logger } @@ -173,4 +173,4 @@ then you should manually implement acknowledgement and retransmission of messages. */ -package yggdrasil +package core diff --git a/src/yggdrasil/link.go b/src/core/link.go similarity index 99% rename from src/yggdrasil/link.go rename to src/core/link.go index b22a59c4..3bdb02ae 100644 --- a/src/yggdrasil/link.go +++ b/src/core/link.go @@ -1,4 +1,4 @@ -package yggdrasil +package core import ( "crypto/ed25519" diff --git a/src/yggdrasil/tcp.go b/src/core/tcp.go similarity index 99% rename from src/yggdrasil/tcp.go rename to src/core/tcp.go index 59ca2ace..9031256a 100644 --- a/src/yggdrasil/tcp.go +++ b/src/core/tcp.go @@ -1,4 +1,4 @@ -package yggdrasil +package core // This sends packets to peers using TCP as a transport // It's generally better tested than the UDP implementation diff --git a/src/yggdrasil/tcp_darwin.go b/src/core/tcp_darwin.go similarity index 97% rename from src/yggdrasil/tcp_darwin.go rename to src/core/tcp_darwin.go index 3d0626c0..6b85c621 100644 --- a/src/yggdrasil/tcp_darwin.go +++ b/src/core/tcp_darwin.go @@ -1,6 +1,6 @@ // +build darwin -package yggdrasil +package core import ( "syscall" diff --git a/src/yggdrasil/tcp_linux.go b/src/core/tcp_linux.go similarity index 98% rename from src/yggdrasil/tcp_linux.go rename to src/core/tcp_linux.go index e18f92b1..39e3ba7a 100644 --- a/src/yggdrasil/tcp_linux.go +++ b/src/core/tcp_linux.go @@ -1,6 +1,6 @@ // +build linux -package yggdrasil +package core import ( "syscall" diff --git a/src/yggdrasil/tcp_other.go b/src/core/tcp_other.go similarity index 94% rename from src/yggdrasil/tcp_other.go rename to src/core/tcp_other.go index 7ee41971..97b81ed1 100644 --- a/src/yggdrasil/tcp_other.go +++ b/src/core/tcp_other.go @@ -1,6 +1,6 @@ // +build !darwin,!linux -package yggdrasil +package core import ( "syscall" diff --git a/src/yggdrasil/tls.go b/src/core/tls.go similarity index 99% rename from src/yggdrasil/tls.go rename to src/core/tls.go index fd8a291c..4fdcf997 100644 --- a/src/yggdrasil/tls.go +++ b/src/core/tls.go @@ -1,4 +1,4 @@ -package yggdrasil +package core import ( "bytes" diff --git a/src/yggdrasil/version.go b/src/core/version.go similarity index 99% rename from src/yggdrasil/version.go rename to src/core/version.go index a3c9bce5..6676c7b6 100644 --- a/src/yggdrasil/version.go +++ b/src/core/version.go @@ -1,4 +1,4 @@ -package yggdrasil +package core // This file contains the version metadata struct // Used in the initial connection setup and key exchange diff --git a/src/module/module.go b/src/module/module.go index 24854e71..d13b8cd2 100644 --- a/src/module/module.go +++ b/src/module/module.go @@ -5,13 +5,13 @@ import ( "github.com/yggdrasil-network/yggdrasil-go/src/admin" "github.com/yggdrasil-network/yggdrasil-go/src/config" - "github.com/yggdrasil-network/yggdrasil-go/src/yggdrasil" + "github.com/yggdrasil-network/yggdrasil-go/src/core" ) // Module is an interface that defines which functions must be supported by a // given Yggdrasil module. type Module interface { - Init(core *yggdrasil.Core, state *config.NodeState, log *log.Logger, options interface{}) error + Init(core *core.Core, state *config.NodeState, log *log.Logger, options interface{}) error Start() error Stop() error SetupAdminHandlers(a *admin.AdminSocket) diff --git a/src/multicast/multicast.go b/src/multicast/multicast.go index 6825776d..b7334da1 100644 --- a/src/multicast/multicast.go +++ b/src/multicast/multicast.go @@ -11,7 +11,7 @@ import ( "github.com/gologme/log" "github.com/yggdrasil-network/yggdrasil-go/src/config" - "github.com/yggdrasil-network/yggdrasil-go/src/yggdrasil" + "github.com/yggdrasil-network/yggdrasil-go/src/core" "golang.org/x/net/ipv6" ) @@ -21,7 +21,7 @@ import ( // automatically. type Multicast struct { phony.Inbox - core *yggdrasil.Core + core *core.Core config *config.NodeState log *log.Logger sock *ipv6.PacketConn @@ -38,13 +38,13 @@ type interfaceInfo struct { } type listenerInfo struct { - listener *yggdrasil.TcpListener + listener *core.TcpListener time time.Time interval time.Duration } // Init prepares the multicast interface for use. -func (m *Multicast) Init(core *yggdrasil.Core, state *config.NodeState, log *log.Logger, options interface{}) error { +func (m *Multicast) Init(core *core.Core, state *config.NodeState, log *log.Logger, options interface{}) error { m.core = core m.config = state m.log = log diff --git a/src/tuntap/tun.go b/src/tuntap/tun.go index 3df42892..49d8e426 100644 --- a/src/tuntap/tun.go +++ b/src/tuntap/tun.go @@ -22,8 +22,8 @@ import ( "github.com/yggdrasil-network/yggdrasil-go/src/address" "github.com/yggdrasil-network/yggdrasil-go/src/config" + "github.com/yggdrasil-network/yggdrasil-go/src/core" "github.com/yggdrasil-network/yggdrasil-go/src/defaults" - "github.com/yggdrasil-network/yggdrasil-go/src/yggdrasil" ) type MTU uint16 @@ -33,7 +33,7 @@ type MTU uint16 // should pass this object to the yggdrasil.SetRouterAdapter() function before // calling yggdrasil.Start(). type TunAdapter struct { - core *yggdrasil.Core + core *core.Core store keyStore config *config.NodeState log *log.Logger @@ -103,7 +103,7 @@ func MaximumMTU() uint64 { // Init initialises the TUN module. You must have acquired a Listener from // the Yggdrasil core before this point and it must not be in use elsewhere. -func (tun *TunAdapter) Init(core *yggdrasil.Core, config *config.NodeState, log *log.Logger, options interface{}) error { +func (tun *TunAdapter) Init(core *core.Core, config *config.NodeState, log *log.Logger, options interface{}) error { tun.core = core tun.store.init(tun) tun.config = config