Merge branch 'develop' into show_console_in_ui_options

This commit is contained in:
Vadym Vikulin 2022-12-11 19:43:56 +02:00 committed by GitHub
commit c23cff9373
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 841 additions and 568 deletions

View file

@ -47,13 +47,17 @@ func (m *Mesh) StartJSON(configjson []byte) error {
if err := json.Unmarshal(configjson, &m.config); err != nil {
return err
}
// Setup the Yggdrasil node itself.
// Setup the Mesh node itself.
{
sk, err := hex.DecodeString(m.config.PrivateKey)
if err != nil {
panic(err)
}
options := []core.SetupOption{}
options := []core.SetupOption{
core.NodeInfo(m.config.NodeInfo),
core.NodeInfoPrivacy(m.config.NodeInfoPrivacy),
core.NetworkDomain(m.config.NetworkDomain),
}
for _, peer := range m.config.Peers {
options = append(options, core.Peer{URI: peer})
}

File diff suppressed because it is too large Load diff

6
contrib/ui/mesh-ui/webview.go Executable file → Normal file
View file

@ -21,7 +21,6 @@ import (
"github.com/RiV-chain/RiV-mesh/src/admin"
"github.com/docopt/docopt-go"
)
var usage = `Graphical interface for RiV mesh.
Usage:
@ -39,9 +38,11 @@ var confui struct {
IndexHtml string `docopt:"<index>"`
Console bool `docopt:"-c,--console"`
}
=======
var uiVersion = "0.0.1"
func main() {
opts, _ := docopt.ParseArgs(usage, os.Args[1:], "0.0.1")
opts, _ := docopt.ParseArgs(usage, os.Args[1:], uiVersion)
opts.Bind(&confui)
if !confui.Console {
Console(false)
@ -220,6 +221,7 @@ func get_self(w webview.WebView) {
go setFieldValue(w, "ipv6", res.IPAddress)
go setFieldValue(w, "pub_key", res.PublicKey)
go setFieldValue(w, "priv_key", res.PrivateKey)
go setFieldValue(w, "version", fmt.Sprintf("v%v/%v", res.BuildVersion, uiVersion))
//found subnet
fmt.Printf("Subnet: %s\n", res.Subnet)
go setFieldValue(w, "subnet", res.Subnet)

View file

@ -20,7 +20,7 @@ import (
// The Core object represents the Mesh node. You should create a Core
// object for each Mesh node you plan to run.
type Core struct {
address Address
// This is the main data structure that holds everything else for a node
// We're going to keep our own copy of the provided config - that way we can
// guarantee that it will be covered by the mutex

View file

@ -8,6 +8,12 @@ type NetworkDomainConfig = config.NetworkDomainConfig
var defaultConfig = "" // LDFLAGS='-X github.com/yggdrasil-network/yggdrasil-go/src/defaults.defaultConfig=/path/to/config
var defaultAdminListen = "" // LDFLAGS='-X github.com/yggdrasil-network/yggdrasil-go/src/defaults.defaultAdminListen=unix://path/to/sock'
type defaultParameters struct {
//Network domain
DefaultNetworkDomain NetworkDomainConfig
}
// Defines which parameters are expected by default for configuration on a
// specific platform. These values are populated in the relevant defaults_*.go
// for the platform being targeted. They must be set.
@ -21,15 +27,23 @@ type platformDefaultParameters struct {
// Multicast interfaces
DefaultMulticastInterfaces []MulticastInterfaceConfig
//Network domain
DefaultNetworkDomain NetworkDomainConfig
// TUN
MaximumIfMTU uint64
DefaultIfMTU uint64
DefaultIfName string
}
// Defines defaults for the all platforms.
func define() defaultParameters {
return defaultParameters{
// Network domain
DefaultNetworkDomain: NetworkDomainConfig{
Prefix: "fc",
},
}
}
func GetDefaults() platformDefaultParameters {
defaults := getDefaults()
if defaultConfig != "" {
@ -56,10 +70,10 @@ func GenerateConfig() *config.NodeConfig {
cfg.InterfacePeers = map[string][]string{}
cfg.AllowedPublicKeys = []string{}
cfg.MulticastInterfaces = defaults.DefaultMulticastInterfaces
cfg.NetworkDomain = defaults.DefaultNetworkDomain
cfg.IfName = defaults.DefaultIfName
cfg.IfMTU = defaults.DefaultIfMTU
cfg.NodeInfoPrivacy = false
cfg.NetworkDomain = define().DefaultNetworkDomain
return cfg
}

View file

@ -19,11 +19,6 @@ func getDefaults() platformDefaultParameters {
{Regex: "bridge.*", Beacon: true, Listen: true},
},
// Network domain
DefaultNetworkDomain: NetworkDomainConfig{
Prefix: "fc",
},
// TUN
MaximumIfMTU: 65535,
DefaultIfMTU: 65535,

View file

@ -18,11 +18,6 @@ func getDefaults() platformDefaultParameters {
{Regex: ".*", Beacon: true, Listen: true},
},
// Network domain
DefaultNetworkDomain: NetworkDomainConfig{
Prefix: "fc",
},
// TUN
MaximumIfMTU: 32767,
DefaultIfMTU: 32767,

View file

@ -18,11 +18,6 @@ func getDefaults() platformDefaultParameters {
{Regex: ".*", Beacon: true, Listen: true},
},
// Network domain
DefaultNetworkDomain: NetworkDomainConfig{
Prefix: "fc",
},
// TUN
MaximumIfMTU: 65535,
DefaultIfMTU: 65535,

View file

@ -18,11 +18,6 @@ func getDefaults() platformDefaultParameters {
{Regex: ".*", Beacon: true, Listen: true},
},
// Network domain
DefaultNetworkDomain: NetworkDomainConfig{
Prefix: "fc",
},
// TUN
MaximumIfMTU: 16384,
DefaultIfMTU: 16384,

View file

@ -18,11 +18,6 @@ func getDefaults() platformDefaultParameters {
{Regex: ".*", Beacon: true, Listen: true},
},
// Network domain
DefaultNetworkDomain: NetworkDomainConfig{
Prefix: "fc",
},
// TUN
MaximumIfMTU: 65535,
DefaultIfMTU: 65535,

View file

@ -18,11 +18,6 @@ func getDefaults() platformDefaultParameters {
{Regex: ".*", Beacon: true, Listen: true},
},
// Network domain
DefaultNetworkDomain: NetworkDomainConfig{
Prefix: "fc",
},
// TUN
MaximumIfMTU: 65535,
DefaultIfMTU: 65535,