1
0
forked from extern/smegmesh

Improving the command help messages

This commit is contained in:
Tim Beatham 2024-08-11 12:24:15 +01:00
parent 83e7f3c004
commit c3241c2764
16 changed files with 26 additions and 38 deletions

3
.gitmodules vendored
View File

@ -1,3 +0,0 @@
[submodule "smegmesh-web"]
path = smegmesh-web
url = git@github.com:tim-beatham/smegmesh-web.git

View File

@ -32,6 +32,10 @@ Redundant routing is possible to create multiple exit points to the same
mesh network. In which case consistent hashing is performed to split traffic mesh network. In which case consistent hashing is performed to split traffic
between the exit points. between the exit points.
## Scalability
The prototype has been tested to a scale of 3000 peers.
## Installation ## Installation
To build the project do: `go build -v ./...`. A Docker file is provided To build the project do: `go build -v ./...`. A Docker file is provided

View File

@ -219,13 +219,11 @@ func main() {
}) })
var newMeshRole *string = newMeshCmd.Selector("r", "role", []string{"peer", "client"}, &argparse.Options{ var newMeshRole *string = newMeshCmd.Selector("r", "role", []string{"peer", "client"}, &argparse.Options{
Help: "Role in the mesh network. A value of peer means that the node is publicly routeable and thus considered" + Help: "Role in the mesh network. A peer is publicly route-able, whereas a client sits behind a private endpoint",
" in the gossip protocol. Client means that the node is not publicly routeable and is not a candidate in the gossip" +
" protocol",
}) })
var newMeshKeepAliveWg *int = newMeshCmd.Int("k", "KeepAliveWg", &argparse.Options{ var newMeshKeepAliveWg *int = newMeshCmd.Int("k", "KeepAliveWg", &argparse.Options{
Default: 0, Default: 0,
Help: "WireGuard KeepAlive value for NAT traversal and firewall holepunching", Help: "WireGuard KeepAlive value for NAT traversal and firewall hole-punching",
}) })
var newMeshAdvertiseRoutes *bool = newMeshCmd.Flag("a", "advertise", &argparse.Options{ var newMeshAdvertiseRoutes *bool = newMeshCmd.Flag("a", "advertise", &argparse.Options{
@ -251,9 +249,9 @@ func main() {
}) })
var joinMeshRole *string = joinMeshCmd.Selector("r", "role", []string{"peer", "client"}, &argparse.Options{ var joinMeshRole *string = joinMeshCmd.Selector("r", "role", []string{"peer", "client"}, &argparse.Options{
Help: "Role in the mesh network. A value of peer means that the node is publicly routeable and thus considered" + Help: "Role in the mesh network. A value of peer means that the node is publicly route-able acting as a router " +
" in the gossip protocol. Client means that the node is not publicly routeable and is not a candidate in the gossip" + "for clients to route packets through. A client sits behind a private endpoint and routes traffic through a single " +
" protocol", "endpoint",
}) })
var joinMeshPort *int = joinMeshCmd.Int("p", "wgport", &argparse.Options{ var joinMeshPort *int = joinMeshCmd.Int("p", "wgport", &argparse.Options{

View File

@ -1,7 +1,6 @@
package main package main
import ( import (
"net/http"
_ "net/http/pprof" _ "net/http/pprof"
"os" "os"
"os/signal" "os/signal"
@ -37,12 +36,6 @@ func main() {
return return
} }
if configuration.Profile {
go func() {
http.ListenAndServe("localhost:6060", nil)
}()
}
var robinRpc robin.WgRpc var robinRpc robin.WgRpc
var robinIpc robin.IpcHandler var robinIpc robin.IpcHandler
var syncProvider sync.SyncServiceImpl var syncProvider sync.SyncServiceImpl

View File

@ -8,8 +8,6 @@ skipCertVerification: true
timeout: 5 timeout: 5
# gRPC port to run the solution # gRPC port to run the solution
gRPCPort: 4000 gRPCPort: 4000
# whether or not to run go profiler
profile: false
# stubWg: whether to install WireGuard configurations # stubWg: whether to install WireGuard configurations
# if true just tests the control plane # if true just tests the control plane
stubWg: false stubWg: false

View File

@ -8,8 +8,6 @@ skipCertVerification: true
timeout: 5 timeout: 5
# gRPC port to run the solution # gRPC port to run the solution
gRPCPort: 4000 gRPCPort: 4000
# whether or not to run go profiler
profile: false
# stubWg: whether to install WireGuard configurations # stubWg: whether to install WireGuard configurations
# if true just tests the control plane # if true just tests the control plane
stubWg: false stubWg: false

View File

@ -1,9 +1,14 @@
version: '3' version: '3'
networks: networks:
net-1: net-1:
enable_ipv6: true
ipam:
driver: default
config:
- subnet: 2001:db8::/64
services: services:
wg-1: wg-1:
image: localhost/smegmesh-base:latest image: smegmesh-base:latest
cap_add: cap_add:
- NET_ADMIN - NET_ADMIN
- NET_RAW - NET_RAW
@ -15,8 +20,9 @@ services:
command: "smegd /shared/configuration.yaml" command: "smegd /shared/configuration.yaml"
sysctls: sysctls:
- net.ipv6.conf.all.forwarding=1 - net.ipv6.conf.all.forwarding=1
- net.ipv6.conf.all.disable_ipv6=0
wg-2: wg-2:
image: localhost/smegmesh-base:latest image: smegmesh-base:latest
cap_add: cap_add:
- NET_ADMIN - NET_ADMIN
- NET_RAW - NET_RAW
@ -28,8 +34,9 @@ services:
command: "smegd /shared/configuration.yaml" command: "smegd /shared/configuration.yaml"
sysctls: sysctls:
- net.ipv6.conf.all.forwarding=1 - net.ipv6.conf.all.forwarding=1
- net.ipv6.conf.all.disable_ipv6=0
wg-3: wg-3:
image: localhost/smegmesh-base:latest image: smegmesh-base:latest
cap_add: cap_add:
- NET_ADMIN - NET_ADMIN
- NET_RAW - NET_RAW
@ -41,3 +48,4 @@ services:
command: "smegd /shared/configuration.yaml" command: "smegd /shared/configuration.yaml"
sysctls: sysctls:
- net.ipv6.conf.all.forwarding=1 - net.ipv6.conf.all.forwarding=1
- net.ipv6.conf.all.disable_ipv6=0

View File

@ -8,8 +8,6 @@ skipCertVerification: true
timeout: 5 timeout: 5
# gRPC port to run the solution # gRPC port to run the solution
gRPCPort: 4000 gRPCPort: 4000
# whether or not to run go profiler
profile: false
# stubWg: whether to install WireGuard configurations # stubWg: whether to install WireGuard configurations
# if true just tests the control plane # if true just tests the control plane
stubWg: false stubWg: false

View File

@ -77,8 +77,6 @@ type DaemonConfiguration struct {
GrpcPort int `yaml:"gRPCPort" validate:"required"` GrpcPort int `yaml:"gRPCPort" validate:"required"`
// Timeout number of seconds without response that a node is considered unreachable by gRPC // Timeout number of seconds without response that a node is considered unreachable by gRPC
Timeout int `yaml:"timeout" validate:"required,gte=1"` Timeout int `yaml:"timeout" validate:"required,gte=1"`
// Profile whether or not to include a http server that profiles the code
Profile bool `yaml:"profile"`
// StubWg whether or not to stub the WireGuard types // StubWg whether or not to stub the WireGuard types
StubWg bool `yaml:"stubWg"` StubWg bool `yaml:"stubWg"`
// SyncInterval specifies how long the minimum time should be between synchronisation // SyncInterval specifies how long the minimum time should be between synchronisation

View File

@ -19,7 +19,6 @@ func getExampleConfiguration() *DaemonConfiguration {
SkipCertVerification: true, SkipCertVerification: true,
GrpcPort: 25, GrpcPort: 25,
Timeout: 5, Timeout: 5,
Profile: false,
StubWg: false, StubWg: false,
SyncInterval: 2, SyncInterval: 2,
Heartbeat: 2, Heartbeat: 2,

View File

@ -31,7 +31,6 @@ func setUpTests() *TestParams {
SkipCertVerification: true, SkipCertVerification: true,
GrpcPort: 0, GrpcPort: 0,
Timeout: 20, Timeout: 20,
Profile: false,
SyncInterval: 2, SyncInterval: 2,
Heartbeat: 10, Heartbeat: 10,
ClusterSize: 32, ClusterSize: 32,

View File

@ -15,7 +15,7 @@ import (
"golang.zx2c4.com/wireguard/wgctrl" "golang.zx2c4.com/wireguard/wgctrl"
) )
// NewCtrlServerParams are the params requried to create a new ctrl server // NewCtrlServerParams are the params required to create a new ctrl server
type NewCtrlServerParams struct { type NewCtrlServerParams struct {
Conf *conf.DaemonConfiguration Conf *conf.DaemonConfiguration
Client *wgctrl.Client Client *wgctrl.Client
@ -52,7 +52,7 @@ func NewCtrlServer(params *NewCtrlServerParams) (*MeshCtrlServer, error) {
IdGenerator: idGenerator, IdGenerator: idGenerator,
IPAllocator: ipAllocator, IPAllocator: ipAllocator,
InterfaceManipulator: interfaceManipulator, InterfaceManipulator: interfaceManipulator,
ConfigApplyer: configApplyer, ConfigApplier: configApplyer,
OnDelete: func(mesh mesh.MeshProvider) { OnDelete: func(mesh mesh.MeshProvider) {
_, err := syncer.Sync(mesh) _, err := syncer.Sync(mesh)

View File

@ -22,7 +22,6 @@ func getMeshConfiguration() *conf.DaemonConfiguration {
CaCertificatePath: "./somecacertificatepath", CaCertificatePath: "./somecacertificatepath",
SkipCertVerification: true, SkipCertVerification: true,
Timeout: 5, Timeout: 5,
Profile: false,
StubWg: true, StubWg: true,
SyncInterval: 2, SyncInterval: 2,
Heartbeat: 60, Heartbeat: 60,
@ -48,7 +47,7 @@ func getMeshManager() MeshManager {
IdGenerator: &lib.UUIDGenerator{}, IdGenerator: &lib.UUIDGenerator{},
IPAllocator: &ip.ULABuilder{}, IPAllocator: &ip.ULABuilder{},
InterfaceManipulator: &wg.WgInterfaceManipulatorStub{}, InterfaceManipulator: &wg.WgInterfaceManipulatorStub{},
ConfigApplyer: &MeshConfigApplyerStub{}, ConfigApplier: &MeshConfigApplyerStub{},
RouteManager: &RouteManagerStub{}, RouteManager: &RouteManagerStub{},
}) })

View File

@ -62,7 +62,7 @@ func (n *IpcHandler) CreateMesh(args *ipc.NewMeshArgs, reply *string) error {
}) })
if err != nil { if err != nil {
return errors.New("could not create mesh") return errors.New("could not create mesh: " + err.Error())
} }
*reply = meshId *reply = meshId

@ -1 +0,0 @@
Subproject commit c1128bcd98a6ce4a04d4fe55c210d115d564419a