mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2024-11-21 23:00:28 +00:00
rename src/yggdrasil to src/core
This commit is contained in:
parent
0343dad934
commit
018f35d9a2
@ -26,15 +26,15 @@ import (
|
|||||||
"github.com/yggdrasil-network/yggdrasil-go/src/admin"
|
"github.com/yggdrasil-network/yggdrasil-go/src/admin"
|
||||||
"github.com/yggdrasil-network/yggdrasil-go/src/config"
|
"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/module"
|
||||||
"github.com/yggdrasil-network/yggdrasil-go/src/multicast"
|
"github.com/yggdrasil-network/yggdrasil-go/src/multicast"
|
||||||
"github.com/yggdrasil-network/yggdrasil-go/src/tuntap"
|
"github.com/yggdrasil-network/yggdrasil-go/src/tuntap"
|
||||||
"github.com/yggdrasil-network/yggdrasil-go/src/version"
|
"github.com/yggdrasil-network/yggdrasil-go/src/version"
|
||||||
"github.com/yggdrasil-network/yggdrasil-go/src/yggdrasil"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type node struct {
|
type node struct {
|
||||||
core yggdrasil.Core
|
core core.Core
|
||||||
state *config.NodeState
|
state *config.NodeState
|
||||||
tuntap module.Module // tuntap.TunAdapter
|
tuntap module.Module // tuntap.TunAdapter
|
||||||
multicast module.Module // multicast.Multicast
|
multicast module.Module // multicast.Multicast
|
||||||
|
@ -14,13 +14,13 @@ import (
|
|||||||
"github.com/gologme/log"
|
"github.com/gologme/log"
|
||||||
|
|
||||||
"github.com/yggdrasil-network/yggdrasil-go/src/config"
|
"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
|
// TODO: Add authentication
|
||||||
|
|
||||||
type AdminSocket struct {
|
type AdminSocket struct {
|
||||||
core *yggdrasil.Core
|
core *core.Core
|
||||||
log *log.Logger
|
log *log.Logger
|
||||||
listenaddr string
|
listenaddr string
|
||||||
listener net.Listener
|
listener net.Listener
|
||||||
@ -63,7 +63,7 @@ func (a *AdminSocket) AddHandler(name string, args []string, handlerfunc func(js
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Init runs the initial admin setup.
|
// 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.core = c
|
||||||
a.log = log
|
a.log = log
|
||||||
a.handlers = make(map[string]handler)
|
a.handlers = make(map[string]handler)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package yggdrasil
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/ed25519"
|
"crypto/ed25519"
|
@ -1,4 +1,4 @@
|
|||||||
package yggdrasil
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/ed25519"
|
"crypto/ed25519"
|
@ -1,4 +1,4 @@
|
|||||||
package yggdrasil
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
@ -1,6 +1,6 @@
|
|||||||
// +build debug
|
// +build debug
|
||||||
|
|
||||||
package yggdrasil
|
package core
|
||||||
|
|
||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
@ -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
|
Introduction
|
||||||
|
|
||||||
@ -34,11 +34,11 @@ This may look something like this:
|
|||||||
"os"
|
"os"
|
||||||
"github.com/gologme/log"
|
"github.com/gologme/log"
|
||||||
"github.com/yggdrasil-network/yggdrasil-go/src/config"
|
"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 {
|
type node struct {
|
||||||
core yggdrasil.Core
|
core core.Core
|
||||||
config *config.NodeConfig
|
config *config.NodeConfig
|
||||||
log *log.Logger
|
log *log.Logger
|
||||||
}
|
}
|
||||||
@ -173,4 +173,4 @@ then you should manually implement acknowledgement and retransmission of
|
|||||||
messages.
|
messages.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
package yggdrasil
|
package core
|
@ -1,4 +1,4 @@
|
|||||||
package yggdrasil
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/ed25519"
|
"crypto/ed25519"
|
@ -1,4 +1,4 @@
|
|||||||
package yggdrasil
|
package core
|
||||||
|
|
||||||
// This sends packets to peers using TCP as a transport
|
// This sends packets to peers using TCP as a transport
|
||||||
// It's generally better tested than the UDP implementation
|
// It's generally better tested than the UDP implementation
|
@ -1,6 +1,6 @@
|
|||||||
// +build darwin
|
// +build darwin
|
||||||
|
|
||||||
package yggdrasil
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"syscall"
|
"syscall"
|
@ -1,6 +1,6 @@
|
|||||||
// +build linux
|
// +build linux
|
||||||
|
|
||||||
package yggdrasil
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"syscall"
|
"syscall"
|
@ -1,6 +1,6 @@
|
|||||||
// +build !darwin,!linux
|
// +build !darwin,!linux
|
||||||
|
|
||||||
package yggdrasil
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"syscall"
|
"syscall"
|
@ -1,4 +1,4 @@
|
|||||||
package yggdrasil
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
@ -1,4 +1,4 @@
|
|||||||
package yggdrasil
|
package core
|
||||||
|
|
||||||
// This file contains the version metadata struct
|
// This file contains the version metadata struct
|
||||||
// Used in the initial connection setup and key exchange
|
// Used in the initial connection setup and key exchange
|
@ -5,13 +5,13 @@ import (
|
|||||||
|
|
||||||
"github.com/yggdrasil-network/yggdrasil-go/src/admin"
|
"github.com/yggdrasil-network/yggdrasil-go/src/admin"
|
||||||
"github.com/yggdrasil-network/yggdrasil-go/src/config"
|
"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
|
// Module is an interface that defines which functions must be supported by a
|
||||||
// given Yggdrasil module.
|
// given Yggdrasil module.
|
||||||
type Module interface {
|
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
|
Start() error
|
||||||
Stop() error
|
Stop() error
|
||||||
SetupAdminHandlers(a *admin.AdminSocket)
|
SetupAdminHandlers(a *admin.AdminSocket)
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
"github.com/gologme/log"
|
"github.com/gologme/log"
|
||||||
|
|
||||||
"github.com/yggdrasil-network/yggdrasil-go/src/config"
|
"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"
|
"golang.org/x/net/ipv6"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ import (
|
|||||||
// automatically.
|
// automatically.
|
||||||
type Multicast struct {
|
type Multicast struct {
|
||||||
phony.Inbox
|
phony.Inbox
|
||||||
core *yggdrasil.Core
|
core *core.Core
|
||||||
config *config.NodeState
|
config *config.NodeState
|
||||||
log *log.Logger
|
log *log.Logger
|
||||||
sock *ipv6.PacketConn
|
sock *ipv6.PacketConn
|
||||||
@ -38,13 +38,13 @@ type interfaceInfo struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type listenerInfo struct {
|
type listenerInfo struct {
|
||||||
listener *yggdrasil.TcpListener
|
listener *core.TcpListener
|
||||||
time time.Time
|
time time.Time
|
||||||
interval time.Duration
|
interval time.Duration
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init prepares the multicast interface for use.
|
// 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.core = core
|
||||||
m.config = state
|
m.config = state
|
||||||
m.log = log
|
m.log = log
|
||||||
|
@ -22,8 +22,8 @@ import (
|
|||||||
|
|
||||||
"github.com/yggdrasil-network/yggdrasil-go/src/address"
|
"github.com/yggdrasil-network/yggdrasil-go/src/address"
|
||||||
"github.com/yggdrasil-network/yggdrasil-go/src/config"
|
"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/defaults"
|
||||||
"github.com/yggdrasil-network/yggdrasil-go/src/yggdrasil"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type MTU uint16
|
type MTU uint16
|
||||||
@ -33,7 +33,7 @@ type MTU uint16
|
|||||||
// should pass this object to the yggdrasil.SetRouterAdapter() function before
|
// should pass this object to the yggdrasil.SetRouterAdapter() function before
|
||||||
// calling yggdrasil.Start().
|
// calling yggdrasil.Start().
|
||||||
type TunAdapter struct {
|
type TunAdapter struct {
|
||||||
core *yggdrasil.Core
|
core *core.Core
|
||||||
store keyStore
|
store keyStore
|
||||||
config *config.NodeState
|
config *config.NodeState
|
||||||
log *log.Logger
|
log *log.Logger
|
||||||
@ -103,7 +103,7 @@ func MaximumMTU() uint64 {
|
|||||||
|
|
||||||
// Init initialises the TUN module. You must have acquired a Listener from
|
// 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.
|
// 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.core = core
|
||||||
tun.store.init(tun)
|
tun.store.init(tun)
|
||||||
tun.config = config
|
tun.config = config
|
||||||
|
Loading…
Reference in New Issue
Block a user