mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03:00
Merge branch 'develop' into show_console_in_ui_options
This commit is contained in:
commit
c23cff9373
11 changed files with 841 additions and 568 deletions
|
@ -47,13 +47,17 @@ func (m *Mesh) StartJSON(configjson []byte) error {
|
||||||
if err := json.Unmarshal(configjson, &m.config); err != nil {
|
if err := json.Unmarshal(configjson, &m.config); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// Setup the Yggdrasil node itself.
|
// Setup the Mesh node itself.
|
||||||
{
|
{
|
||||||
sk, err := hex.DecodeString(m.config.PrivateKey)
|
sk, err := hex.DecodeString(m.config.PrivateKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
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 {
|
for _, peer := range m.config.Peers {
|
||||||
options = append(options, core.Peer{URI: peer})
|
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
6
contrib/ui/mesh-ui/webview.go
Executable file → Normal file
|
@ -21,7 +21,6 @@ import (
|
||||||
"github.com/RiV-chain/RiV-mesh/src/admin"
|
"github.com/RiV-chain/RiV-mesh/src/admin"
|
||||||
"github.com/docopt/docopt-go"
|
"github.com/docopt/docopt-go"
|
||||||
)
|
)
|
||||||
|
|
||||||
var usage = `Graphical interface for RiV mesh.
|
var usage = `Graphical interface for RiV mesh.
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
|
@ -39,9 +38,11 @@ var confui struct {
|
||||||
IndexHtml string `docopt:"<index>"`
|
IndexHtml string `docopt:"<index>"`
|
||||||
Console bool `docopt:"-c,--console"`
|
Console bool `docopt:"-c,--console"`
|
||||||
}
|
}
|
||||||
|
=======
|
||||||
|
var uiVersion = "0.0.1"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
opts, _ := docopt.ParseArgs(usage, os.Args[1:], "0.0.1")
|
opts, _ := docopt.ParseArgs(usage, os.Args[1:], uiVersion)
|
||||||
opts.Bind(&confui)
|
opts.Bind(&confui)
|
||||||
if !confui.Console {
|
if !confui.Console {
|
||||||
Console(false)
|
Console(false)
|
||||||
|
@ -220,6 +221,7 @@ func get_self(w webview.WebView) {
|
||||||
go setFieldValue(w, "ipv6", res.IPAddress)
|
go setFieldValue(w, "ipv6", res.IPAddress)
|
||||||
go setFieldValue(w, "pub_key", res.PublicKey)
|
go setFieldValue(w, "pub_key", res.PublicKey)
|
||||||
go setFieldValue(w, "priv_key", res.PrivateKey)
|
go setFieldValue(w, "priv_key", res.PrivateKey)
|
||||||
|
go setFieldValue(w, "version", fmt.Sprintf("v%v/%v", res.BuildVersion, uiVersion))
|
||||||
//found subnet
|
//found subnet
|
||||||
fmt.Printf("Subnet: %s\n", res.Subnet)
|
fmt.Printf("Subnet: %s\n", res.Subnet)
|
||||||
go setFieldValue(w, "subnet", res.Subnet)
|
go setFieldValue(w, "subnet", res.Subnet)
|
||||||
|
|
|
@ -20,7 +20,7 @@ import (
|
||||||
// The Core object represents the Mesh node. You should create a Core
|
// The Core object represents the Mesh node. You should create a Core
|
||||||
// object for each Mesh node you plan to run.
|
// object for each Mesh node you plan to run.
|
||||||
type Core struct {
|
type Core struct {
|
||||||
address Address
|
|
||||||
// This is the main data structure that holds everything else for a node
|
// 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
|
// 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
|
// guarantee that it will be covered by the mutex
|
||||||
|
|
|
@ -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 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'
|
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
|
// Defines which parameters are expected by default for configuration on a
|
||||||
// specific platform. These values are populated in the relevant defaults_*.go
|
// specific platform. These values are populated in the relevant defaults_*.go
|
||||||
// for the platform being targeted. They must be set.
|
// for the platform being targeted. They must be set.
|
||||||
|
@ -21,15 +27,23 @@ type platformDefaultParameters struct {
|
||||||
// Multicast interfaces
|
// Multicast interfaces
|
||||||
DefaultMulticastInterfaces []MulticastInterfaceConfig
|
DefaultMulticastInterfaces []MulticastInterfaceConfig
|
||||||
|
|
||||||
//Network domain
|
|
||||||
DefaultNetworkDomain NetworkDomainConfig
|
|
||||||
|
|
||||||
// TUN
|
// TUN
|
||||||
MaximumIfMTU uint64
|
MaximumIfMTU uint64
|
||||||
DefaultIfMTU uint64
|
DefaultIfMTU uint64
|
||||||
DefaultIfName string
|
DefaultIfName string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Defines defaults for the all platforms.
|
||||||
|
func define() defaultParameters {
|
||||||
|
return defaultParameters{
|
||||||
|
|
||||||
|
// Network domain
|
||||||
|
DefaultNetworkDomain: NetworkDomainConfig{
|
||||||
|
Prefix: "fc",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func GetDefaults() platformDefaultParameters {
|
func GetDefaults() platformDefaultParameters {
|
||||||
defaults := getDefaults()
|
defaults := getDefaults()
|
||||||
if defaultConfig != "" {
|
if defaultConfig != "" {
|
||||||
|
@ -56,10 +70,10 @@ func GenerateConfig() *config.NodeConfig {
|
||||||
cfg.InterfacePeers = map[string][]string{}
|
cfg.InterfacePeers = map[string][]string{}
|
||||||
cfg.AllowedPublicKeys = []string{}
|
cfg.AllowedPublicKeys = []string{}
|
||||||
cfg.MulticastInterfaces = defaults.DefaultMulticastInterfaces
|
cfg.MulticastInterfaces = defaults.DefaultMulticastInterfaces
|
||||||
cfg.NetworkDomain = defaults.DefaultNetworkDomain
|
|
||||||
cfg.IfName = defaults.DefaultIfName
|
cfg.IfName = defaults.DefaultIfName
|
||||||
cfg.IfMTU = defaults.DefaultIfMTU
|
cfg.IfMTU = defaults.DefaultIfMTU
|
||||||
cfg.NodeInfoPrivacy = false
|
cfg.NodeInfoPrivacy = false
|
||||||
|
cfg.NetworkDomain = define().DefaultNetworkDomain
|
||||||
|
|
||||||
return cfg
|
return cfg
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,11 +19,6 @@ func getDefaults() platformDefaultParameters {
|
||||||
{Regex: "bridge.*", Beacon: true, Listen: true},
|
{Regex: "bridge.*", Beacon: true, Listen: true},
|
||||||
},
|
},
|
||||||
|
|
||||||
// Network domain
|
|
||||||
DefaultNetworkDomain: NetworkDomainConfig{
|
|
||||||
Prefix: "fc",
|
|
||||||
},
|
|
||||||
|
|
||||||
// TUN
|
// TUN
|
||||||
MaximumIfMTU: 65535,
|
MaximumIfMTU: 65535,
|
||||||
DefaultIfMTU: 65535,
|
DefaultIfMTU: 65535,
|
||||||
|
|
|
@ -18,11 +18,6 @@ func getDefaults() platformDefaultParameters {
|
||||||
{Regex: ".*", Beacon: true, Listen: true},
|
{Regex: ".*", Beacon: true, Listen: true},
|
||||||
},
|
},
|
||||||
|
|
||||||
// Network domain
|
|
||||||
DefaultNetworkDomain: NetworkDomainConfig{
|
|
||||||
Prefix: "fc",
|
|
||||||
},
|
|
||||||
|
|
||||||
// TUN
|
// TUN
|
||||||
MaximumIfMTU: 32767,
|
MaximumIfMTU: 32767,
|
||||||
DefaultIfMTU: 32767,
|
DefaultIfMTU: 32767,
|
||||||
|
|
|
@ -18,11 +18,6 @@ func getDefaults() platformDefaultParameters {
|
||||||
{Regex: ".*", Beacon: true, Listen: true},
|
{Regex: ".*", Beacon: true, Listen: true},
|
||||||
},
|
},
|
||||||
|
|
||||||
// Network domain
|
|
||||||
DefaultNetworkDomain: NetworkDomainConfig{
|
|
||||||
Prefix: "fc",
|
|
||||||
},
|
|
||||||
|
|
||||||
// TUN
|
// TUN
|
||||||
MaximumIfMTU: 65535,
|
MaximumIfMTU: 65535,
|
||||||
DefaultIfMTU: 65535,
|
DefaultIfMTU: 65535,
|
||||||
|
|
|
@ -18,11 +18,6 @@ func getDefaults() platformDefaultParameters {
|
||||||
{Regex: ".*", Beacon: true, Listen: true},
|
{Regex: ".*", Beacon: true, Listen: true},
|
||||||
},
|
},
|
||||||
|
|
||||||
// Network domain
|
|
||||||
DefaultNetworkDomain: NetworkDomainConfig{
|
|
||||||
Prefix: "fc",
|
|
||||||
},
|
|
||||||
|
|
||||||
// TUN
|
// TUN
|
||||||
MaximumIfMTU: 16384,
|
MaximumIfMTU: 16384,
|
||||||
DefaultIfMTU: 16384,
|
DefaultIfMTU: 16384,
|
||||||
|
|
|
@ -18,11 +18,6 @@ func getDefaults() platformDefaultParameters {
|
||||||
{Regex: ".*", Beacon: true, Listen: true},
|
{Regex: ".*", Beacon: true, Listen: true},
|
||||||
},
|
},
|
||||||
|
|
||||||
// Network domain
|
|
||||||
DefaultNetworkDomain: NetworkDomainConfig{
|
|
||||||
Prefix: "fc",
|
|
||||||
},
|
|
||||||
|
|
||||||
// TUN
|
// TUN
|
||||||
MaximumIfMTU: 65535,
|
MaximumIfMTU: 65535,
|
||||||
DefaultIfMTU: 65535,
|
DefaultIfMTU: 65535,
|
||||||
|
|
|
@ -18,11 +18,6 @@ func getDefaults() platformDefaultParameters {
|
||||||
{Regex: ".*", Beacon: true, Listen: true},
|
{Regex: ".*", Beacon: true, Listen: true},
|
||||||
},
|
},
|
||||||
|
|
||||||
// Network domain
|
|
||||||
DefaultNetworkDomain: NetworkDomainConfig{
|
|
||||||
Prefix: "fc",
|
|
||||||
},
|
|
||||||
|
|
||||||
// TUN
|
// TUN
|
||||||
MaximumIfMTU: 65535,
|
MaximumIfMTU: 65535,
|
||||||
DefaultIfMTU: 65535,
|
DefaultIfMTU: 65535,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue