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
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))
@ -18,7 +18,7 @@ $(addprefix $(OUT_DIR)/,$(ALL_PLATFORMS)):
linux-amd64: $(addprefix linux-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-%: BUILD_ENV=GO111MODULE=on

View file

@ -51,7 +51,7 @@ type MulticastInterfaceConfig struct {
}
type NetworkDomainConfig struct {
Prefix [1]byte
Prefix string
}
// NewSigningKeys replaces the signing keypair in the NodeConfig with a new

View file

@ -4,6 +4,7 @@ package core
import (
"crypto/ed25519"
"encoding/hex"
)
// 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).
// 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 {
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.

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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