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
between the exit points.
## Scalability
The prototype has been tested to a scale of 3000 peers.
## Installation
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{
Help: "Role in the mesh network. A value of peer means that the node is publicly routeable and thus considered" +
" in the gossip protocol. Client means that the node is not publicly routeable and is not a candidate in the gossip" +
" protocol",
Help: "Role in the mesh network. A peer is publicly route-able, whereas a client sits behind a private endpoint",
})
var newMeshKeepAliveWg *int = newMeshCmd.Int("k", "KeepAliveWg", &argparse.Options{
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{
@ -251,9 +249,9 @@ func main() {
})
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" +
" in the gossip protocol. Client means that the node is not publicly routeable and is not a candidate in the gossip" +
" protocol",
Help: "Role in the mesh network. A value of peer means that the node is publicly route-able acting as a router " +
"for clients to route packets through. A client sits behind a private endpoint and routes traffic through a single " +
"endpoint",
})
var joinMeshPort *int = joinMeshCmd.Int("p", "wgport", &argparse.Options{

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -77,8 +77,6 @@ type DaemonConfiguration struct {
GrpcPort int `yaml:"gRPCPort" validate:"required"`
// Timeout number of seconds without response that a node is considered unreachable by gRPC
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 bool `yaml:"stubWg"`
// SyncInterval specifies how long the minimum time should be between synchronisation

View File

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

View File

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

View File

@ -15,7 +15,7 @@ import (
"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 {
Conf *conf.DaemonConfiguration
Client *wgctrl.Client
@ -52,7 +52,7 @@ func NewCtrlServer(params *NewCtrlServerParams) (*MeshCtrlServer, error) {
IdGenerator: idGenerator,
IPAllocator: ipAllocator,
InterfaceManipulator: interfaceManipulator,
ConfigApplyer: configApplyer,
ConfigApplier: configApplyer,
OnDelete: func(mesh mesh.MeshProvider) {
_, err := syncer.Sync(mesh)

View File

@ -279,7 +279,7 @@ func (m *WgMeshConfigApplyer) getClientConfig(params *GetConfigParams) (*wgtypes
installedRoutes := make([]lib.Route, 0)
for _, route := range peerCfgs[0].AllowedIPs {
// Don't install routes that we are directly apart
// Don't install routes that we are directly a part
// Dont install default route wgctrl handles this for us
if !meshNet.Contains(route.IP) {
installedRoutes = append(installedRoutes, lib.Route{

View File

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

View File

@ -62,7 +62,7 @@ func (n *IpcHandler) CreateMesh(args *ipc.NewMeshArgs, reply *string) error {
})
if err != nil {
return errors.New("could not create mesh")
return errors.New("could not create mesh: " + err.Error())
}
*reply = meshId
@ -89,7 +89,7 @@ func (n *IpcHandler) JoinMesh(args *ipc.JoinMeshArgs, reply *string) error {
overrideConf := getOverrideConfiguration(&args.WgArgs)
if n.Server.GetMeshManager().GetMesh(args.MeshId) != nil {
return fmt.Errorf("user is already apart of the mesh")
return fmt.Errorf("user is already a part of the mesh")
}
peerConnection, err := n.Server.GetConnectionManager().GetConnection(args.IpAddress)

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