Added makefile and separate binaries compilation

This commit is contained in:
Mihail Slobodyanuk 2022-12-09 15:10:05 +02:00
commit cce209d944
10 changed files with 36 additions and 29 deletions

View file

@ -5,7 +5,7 @@ ALL_EXE=mesh meshctl mesh_ui
OUT_DIR=built OUT_DIR=built
PATH:=/devroot/toolchain/amd64-w64-mingw32-seh-cpp20/bin:$(PATH) PATH:=/devroot/toolchain/x86_64-w64-mingw32-seh-cpp20/bin:$(PATH)
take=$(word $1,$(subst -, ,$2)) take=$(word $1,$(subst -, ,$2))
@ -18,7 +18,7 @@ $(addprefix $(OUT_DIR)/,$(ALL_PLATFORMS)):
linux-amd64: $(addprefix linux-amd64-,$(ALL_EXE)) linux-amd64: $(addprefix linux-amd64-,$(ALL_EXE))
windows-amd64: $(addprefix windows-amd64-,$(ALL_EXE)) windows-amd64: $(addprefix windows-amd64-,$(ALL_EXE))
windows-amd64-%: BUILD_ENV=CGO_ENABLED=1 CC=amd64-w64-mingw32-gcc CXX=amd64-w64-mingw32-g++ windows-amd64-%: BUILD_ENV=CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++
macos-amd64: $(addprefix macos-amd64-,$(ALL_EXE)) macos-amd64: $(addprefix macos-amd64-,$(ALL_EXE))
macos-amd64-%: BUILD_ENV=GO111MODULE=on macos-amd64-%: BUILD_ENV=GO111MODULE=on

View file

@ -43,15 +43,15 @@ type NodeConfig struct {
} }
type MulticastInterfaceConfig struct { type MulticastInterfaceConfig struct {
Regex string Regex string
Beacon bool Beacon bool
Listen bool Listen bool
Port uint16 Port uint16
Priority uint64 // really uint8, but gobind won't export it Priority uint64 // really uint8, but gobind won't export it
} }
type NetworkDomainConfig struct { type NetworkDomainConfig struct {
Prefix [1]byte Prefix string
} }
// NewSigningKeys replaces the signing keypair in the NodeConfig with a new // NewSigningKeys replaces the signing keypair in the NodeConfig with a new

View file

@ -4,6 +4,7 @@ package core
import ( import (
"crypto/ed25519" "crypto/ed25519"
"encoding/hex"
) )
// Address represents an IPv6 address in the mesh address range. // Address represents an IPv6 address in the mesh address range.
@ -17,7 +18,13 @@ type Subnet [8]byte
// The 8th bit of the last byte is used to signal nodes (0) or /64 prefixes (1). // The 8th bit of the last byte is used to signal nodes (0) or /64 prefixes (1).
// Nodes that configure this differently will be unable to communicate with each other using IP packets, though routing and the DHT machinery *should* still work. // Nodes that configure this differently will be unable to communicate with each other using IP packets, though routing and the DHT machinery *should* still work.
func (c *Core) GetPrefix() [1]byte { func (c *Core) GetPrefix() [1]byte {
return c.config.networkdomain.Prefix p, err := hex.DecodeString(c.config.networkdomain.Prefix)
if err != nil {
panic(err)
}
var prefix [1]byte
copy(prefix[:], p[:1])
return prefix
} }
// IsValid returns true if an address falls within the range used by nodes in the network. // IsValid returns true if an address falls within the range used by nodes in the network.

View file

@ -35,7 +35,7 @@ type Peer struct {
type NodeInfo map[string]interface{} type NodeInfo map[string]interface{}
type NodeInfoPrivacy bool type NodeInfoPrivacy bool
type NetworkDomain struct { type NetworkDomain struct {
Prefix [1]byte Prefix string
} }
type AllowedPublicKey ed25519.PublicKey type AllowedPublicKey ed25519.PublicKey

View file

@ -20,9 +20,9 @@ func getDefaults() platformDefaultParameters {
}, },
// Network domain // Network domain
DefaultNetworkDomain: NetworkDomainConfig{ DefaultNetworkDomain: NetworkDomainConfig{
Prefix: [...]byte{0xfc}, Prefix: "fc",
}, },
// TUN // TUN
MaximumIfMTU: 65535, MaximumIfMTU: 65535,

View file

@ -18,10 +18,10 @@ func getDefaults() platformDefaultParameters {
{Regex: ".*", Beacon: true, Listen: true}, {Regex: ".*", Beacon: true, Listen: true},
}, },
// Network domain // Network domain
DefaultNetworkDomain: NetworkDomainConfig{ DefaultNetworkDomain: NetworkDomainConfig{
Prefix: [...]byte{0xfc}, Prefix: "fc",
}, },
// TUN // TUN
MaximumIfMTU: 32767, MaximumIfMTU: 32767,

View file

@ -18,10 +18,10 @@ func getDefaults() platformDefaultParameters {
{Regex: ".*", Beacon: true, Listen: true}, {Regex: ".*", Beacon: true, Listen: true},
}, },
// Network domain // Network domain
DefaultNetworkDomain: NetworkDomainConfig{ DefaultNetworkDomain: NetworkDomainConfig{
Prefix: [...]byte{0xfc}, Prefix: "fc",
}, },
// TUN // TUN
MaximumIfMTU: 65535, MaximumIfMTU: 65535,

View file

@ -18,10 +18,10 @@ func getDefaults() platformDefaultParameters {
{Regex: ".*", Beacon: true, Listen: true}, {Regex: ".*", Beacon: true, Listen: true},
}, },
// Network domain // Network domain
DefaultNetworkDomain: NetworkDomainConfig{ DefaultNetworkDomain: NetworkDomainConfig{
Prefix: [...]byte{0xfc}, Prefix: "fc",
}, },
// TUN // TUN
MaximumIfMTU: 16384, MaximumIfMTU: 16384,

View file

@ -18,10 +18,10 @@ func getDefaults() platformDefaultParameters {
{Regex: ".*", Beacon: true, Listen: true}, {Regex: ".*", Beacon: true, Listen: true},
}, },
// Network domain // Network domain
DefaultNetworkDomain: NetworkDomainConfig{ DefaultNetworkDomain: NetworkDomainConfig{
Prefix: [...]byte{0xfc}, Prefix: "fc",
}, },
// TUN // TUN
MaximumIfMTU: 65535, MaximumIfMTU: 65535,

View file

@ -20,7 +20,7 @@ func getDefaults() platformDefaultParameters {
// Network domain // Network domain
DefaultNetworkDomain: NetworkDomainConfig{ DefaultNetworkDomain: NetworkDomainConfig{
Prefix: [...]byte{0xfc}, Prefix: "fc",
}, },
// TUN // TUN