mirror of
https://github.com/yggdrasil-network/yggdrasil-go
synced 2024-11-10 07:20:39 +03:00
Merge branch 'develop' into metadata
This commit is contained in:
commit
5417e33520
@ -191,19 +191,8 @@ func main() {
|
|||||||
}
|
}
|
||||||
// Check to see if the peers are in a parsable format, if not then default
|
// Check to see if the peers are in a parsable format, if not then default
|
||||||
// them to the TCP scheme
|
// them to the TCP scheme
|
||||||
for index, peer := range dat["Peers"].([]interface{}) {
|
if peers, ok := dat["Peers"].([]interface{}); ok {
|
||||||
uri := peer.(string)
|
for index, peer := range peers {
|
||||||
if strings.HasPrefix(uri, "tcp://") || strings.HasPrefix(uri, "socks://") {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if strings.HasPrefix(uri, "tcp:") {
|
|
||||||
uri = uri[4:]
|
|
||||||
}
|
|
||||||
(dat["Peers"].([]interface{}))[index] = "tcp://" + uri
|
|
||||||
}
|
|
||||||
// Now do the same with the interface peers
|
|
||||||
for intf, peers := range dat["InterfacePeers"].(map[string]interface{}) {
|
|
||||||
for index, peer := range peers.([]interface{}) {
|
|
||||||
uri := peer.(string)
|
uri := peer.(string)
|
||||||
if strings.HasPrefix(uri, "tcp://") || strings.HasPrefix(uri, "socks://") {
|
if strings.HasPrefix(uri, "tcp://") || strings.HasPrefix(uri, "socks://") {
|
||||||
continue
|
continue
|
||||||
@ -211,7 +200,22 @@ func main() {
|
|||||||
if strings.HasPrefix(uri, "tcp:") {
|
if strings.HasPrefix(uri, "tcp:") {
|
||||||
uri = uri[4:]
|
uri = uri[4:]
|
||||||
}
|
}
|
||||||
((dat["InterfacePeers"].(map[string]interface{}))[intf]).([]interface{})[index] = "tcp://" + uri
|
(dat["Peers"].([]interface{}))[index] = "tcp://" + uri
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Now do the same with the interface peers
|
||||||
|
if interfacepeers, ok := dat["InterfacePeers"].(map[string]interface{}); ok {
|
||||||
|
for intf, peers := range interfacepeers {
|
||||||
|
for index, peer := range peers.([]interface{}) {
|
||||||
|
uri := peer.(string)
|
||||||
|
if strings.HasPrefix(uri, "tcp://") || strings.HasPrefix(uri, "socks://") {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if strings.HasPrefix(uri, "tcp:") {
|
||||||
|
uri = uri[4:]
|
||||||
|
}
|
||||||
|
((dat["InterfacePeers"].(map[string]interface{}))[intf]).([]interface{})[index] = "tcp://" + uri
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Overlay our newly mapped configuration onto the autoconf node config that
|
// Overlay our newly mapped configuration onto the autoconf node config that
|
||||||
|
Loading…
Reference in New Issue
Block a user