mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-29 14:45:07 +03:00
Merge branch 'develop' of https://github.com/yggdrasil-network/yggdrasil-go into yggdrasil-v0.4.7-develop
This commit is contained in:
commit
35cc180647
20 changed files with 309 additions and 178 deletions
|
@ -13,8 +13,9 @@ import (
|
|||
"net"
|
||||
"os"
|
||||
|
||||
c "github.com/RiV-chain/RiV-mesh/src/core"
|
||||
"github.com/cheggaaa/pb/v3"
|
||||
"github.com/RiV-chain/RiV-mesh/src/address"
|
||||
"github.com/gologme/log"
|
||||
)
|
||||
|
||||
var numHosts = flag.Int("hosts", 1, "number of host vars to generate")
|
||||
|
@ -35,7 +36,6 @@ func main() {
|
|||
println("Can't generate less keys than hosts.")
|
||||
return
|
||||
}
|
||||
|
||||
var keys []keySet
|
||||
for i := 0; i < *numHosts+1; i++ {
|
||||
keys = append(keys, newKey())
|
||||
|
@ -77,7 +77,9 @@ func newKey() keySet {
|
|||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
ip := net.IP(address.AddrForKey(pub)[:]).String()
|
||||
logger := log.New(os.Stdout, "", log.Flags())
|
||||
core, _ := c.New(priv, logger, nil)
|
||||
ip := net.IP(core.AddrForKey(pub)[:]).String()
|
||||
return keySet{priv[:], pub[:], ip}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,6 @@ import (
|
|||
"github.com/RiV-chain/RiV-mesh/src/ipv6rwc"
|
||||
"github.com/RiV-chain/RiV-mesh/src/multicast"
|
||||
"github.com/RiV-chain/RiV-mesh/src/version"
|
||||
|
||||
_ "golang.org/x/mobile/bind"
|
||||
)
|
||||
|
||||
// RiV-mesh mobile package is meant to "plug the gap" for mobile support, as
|
||||
|
@ -83,10 +81,10 @@ func (m *Mesh) StartJSON(configjson []byte) error {
|
|||
options := []multicast.SetupOption{}
|
||||
for _, intf := range m.config.MulticastInterfaces {
|
||||
options = append(options, multicast.MulticastInterface{
|
||||
Regex: regexp.MustCompile(intf.Regex),
|
||||
Beacon: intf.Beacon,
|
||||
Listen: intf.Listen,
|
||||
Port: intf.Port,
|
||||
Regex: regexp.MustCompile(intf.Regex),
|
||||
Beacon: intf.Beacon,
|
||||
Listen: intf.Listen,
|
||||
Port: intf.Port,
|
||||
Priority: uint8(intf.Priority),
|
||||
})
|
||||
}
|
||||
|
@ -159,6 +157,11 @@ func (m *Mesh) Stop() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Retry resets the peer connection timer and tries to dial them immediately.
|
||||
func (m *Mesh) RetryPeersNow() {
|
||||
m.core.RetryPeersNow()
|
||||
}
|
||||
|
||||
// GenerateConfigJSON generates mobile-friendly configuration in JSON format
|
||||
func GenerateConfigJSON() []byte {
|
||||
nc := defaults.GenerateConfig()
|
||||
|
|
|
@ -3,7 +3,7 @@ package mobile
|
|||
import "testing"
|
||||
|
||||
func TestStartYggdrasil(t *testing.T) {
|
||||
ygg := &Mesh{}
|
||||
mesh := &Mesh{}
|
||||
if err := mesh.StartAutoconfigure(); err != nil {
|
||||
t.Fatalf("Failed to start Mesh: %s", err)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue