Skip to content
This repository has been archived by the owner on Oct 27, 2023. It is now read-only.

Commit

Permalink
Update yggdrasil-go version to 0.4.0 (#27)
Browse files Browse the repository at this point in the history
Co-authored-by: George <[email protected]>
  • Loading branch information
zhoreeq and zhoreeq committed Jul 9, 2021
1 parent 6b52234 commit 0270fec
Show file tree
Hide file tree
Showing 22 changed files with 618 additions and 845 deletions.
52 changes: 13 additions & 39 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ jobs:
go get github.com/golangci/golangci-lint/cmd/[email protected]
golangci-lint run
- run:
name: Run Go tests
command: |
go test ./...
build-linux:
docker:
- image: circleci/golang:1.16
Expand Down Expand Up @@ -157,43 +162,6 @@ jobs:
paths:
- upload

build-windows:
docker:
- image: circleci/golang:1.16

steps:
- checkout

- run:
name: Create artifact upload directory and set variables
command: |
mkdir /tmp/upload
echo 'export CINAME=$(sh contrib/semver/name.sh)' >> $BASH_ENV
echo 'export CIVERSION=$(sh contrib/semver/version.sh --bare)' >> $BASH_ENV
git config --global user.email "$(git log --format='%ae' HEAD -1)";
git config --global user.name "$(git log --format='%an' HEAD -1)";
- run:
name: Install tools
command: |
sudo apt-get update
sudo apt-get -y install msitools wixl
- run:
name: Build for Windows
command: |
rm -f {yggdrasil,yggdrasilctl}
GOOS=windows GOARCH=amd64 ./build && mv yggdrasil.exe /tmp/upload/$CINAME-$CIVERSION-windows-amd64.exe && mv yggdrasilctl.exe /tmp/upload/$CINAME-$CIVERSION-yggdrasilctl-windows-amd64.exe;
GOOS=windows GOARCH=386 ./build && mv yggdrasil.exe /tmp/upload/$CINAME-$CIVERSION-windows-i386.exe && mv yggdrasilctl.exe /tmp/upload/$CINAME-$CIVERSION-yggdrasilctl-windows-i386.exe;
bash contrib/msi/build-msi.sh x64
bash contrib/msi/build-msi.sh x86
mv *.msi /tmp/upload
- persist_to_workspace:
root: /tmp
paths:
- upload

build-other:
docker:
- image: circleci/golang:1.16
Expand Down Expand Up @@ -224,6 +192,13 @@ jobs:
GOOS=freebsd GOARCH=amd64 ./build && mv yggdrasil /tmp/upload/$CINAME-$CIVERSION-freebsd-amd64 && mv yggdrasilctl /tmp/upload/$CINAME-$CIVERSION-yggdrasilctl-freebsd-amd64;
GOOS=freebsd GOARCH=386 ./build && mv yggdrasil /tmp/upload/$CINAME-$CIVERSION-freebsd-i386 && mv yggdrasilctl /tmp/upload/$CINAME-$CIVERSION-yggdrasilctl-freebsd-i386;
- run:
name: Build for Windows
command: |
rm -f {yggdrasil,yggdrasilctl}
GOOS=windows GOARCH=amd64 ./build && mv yggdrasil.exe /tmp/upload/$CINAME-$CIVERSION-windows-amd64.exe && mv yggdrasilctl.exe /tmp/upload/$CINAME-$CIVERSION-yggdrasilctl-windows-amd64.exe;
GOOS=windows GOARCH=386 ./build && mv yggdrasil.exe /tmp/upload/$CINAME-$CIVERSION-windows-i386.exe && mv yggdrasilctl.exe /tmp/upload/$CINAME-$CIVERSION-yggdrasilctl-windows-i386.exe;
- persist_to_workspace:
root: /tmp
paths:
Expand All @@ -244,11 +219,10 @@ workflows:
version: 2.1
build:
jobs:
- lint
- build-linux
- build-windows
- build-other
- upload:
requires:
- build-linux
- build-windows
- build-other
20 changes: 20 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: '{build}'
pull_requests:
do_not_increment_build_number: true
os: Visual Studio 2019
shallow_clone: false

environment:
MSYS2_PATH_TYPE: inherit
CHERE_INVOKING: enabled_from_arguments

build_script:
- cmd: >-
cd %APPVEYOR_BUILD_FOLDER%
- c:\msys64\usr\bin\bash -lc "./contrib/msi/build-msi.sh x64"
- c:\msys64\usr\bin\bash -lc "./contrib/msi/build-msi.sh x86"

test: off

artifacts:
- path: '*.msi'
165 changes: 54 additions & 111 deletions assets/peers.txt
Original file line number Diff line number Diff line change
@@ -1,121 +1,64 @@
tcp://104.248.15.125:31337
tcp://108.175.10.127:61216
tcp://139.162.119.37:44478
tcp://140.238.168.104:17117
tcp://176.101.222.31:27363
tcp://176.215.237.83:2755
tcp://176.223.130.120:22632
tcp://188.226.125.64:54321
tcp://194.177.21.156:5066
tcp://159.203.12.215:1010
tls://159.203.12.215:1020
tcp://195.123.245.146:7743
tcp://198.58.100.240:44478
tcp://[2001:19f0:5401:272a:5400:2ff:fe21:7a26]:8082
tcp://[2001:19f0:7402:431:5400:2ff:fe21:7912]:8082
tcp://[2001:1af8:4700:a119:7::1]:35239
tcp://[2001:41d0:2:c44a:51:255:223:60]:26409
tcp://[2001:41d0:401:3000::4227]:62506
tcp://[2001:41d0:601:1100::cf2]:37145
tcp://[2001:8d8:1800:8224::1]:61216
tcp://[2001:bc8:1820:192f::1]:62486
tcp://212.129.52.193:39565
tcp://217.195.164.4:10000
tcp://[2400:8902::f03c:91ff:fe1f:c32a]:44478
tcp://[2600:3c00::f03c:91ff:feae:3efa]:44478
tcp://[2604:a880:400:d0::16e5:7001]:19103
tcp://[2604:a880:800:c1::2c2:a001]:31337
tcp://[2607:f1c0:1801:d4::1]:61216
tcp://[2804:49fc::ffff:ffff:5b5:e8be]:58301
tcp://[2a00:b700:2::6:69]:1333
tcp://[2a02:17d0:1b4:bddd::7]:54321
tcp://37.205.14.171:46370
tcp://[2a03:3b40:fe:ab::1]:46370
tcp://[2a03:6f00:5:1::59df:79d3]:5353
tcp://[2a05:3580:d900:1b13:e2d5:5eff:fed8:8b86]:8777
tcp://[2a05:9403::8b]:7743
tcp://37.205.14.171:46370
tcp://45.11.19.26:5001
tcp://45.231.133.188:58301
tcp://45.76.137.140:8082
tcp://45.77.107.150:34660
tcp://46.105.92.61:62506
tcp://46.151.26.194:60575
tcp://50.236.201.218:56088
tcp://51.15.118.10:62486
tls://217.195.164.4:10531
tcp://212.129.52.193:39565
tcp://51.15.204.214:12345
tcp://51.255.223.60:26409
tcp://51.75.44.73:50001
tcp://54.37.137.221:37145
tcp://64.112.176.176:1617
tcp://64.112.177.94:1617
tcp://64.112.180.77:1617
tcp://64.112.182.119:1617
tcp://64.112.182.182:1617
tcp://67.205.187.55:19103
tcp://78.27.153.163:33165
tcp://82.165.69.111:61216
tcp://85.17.15.221:35239
tcp://88.201.129.205:8777
tcp://89.223.121.211:5353
tcp://91.206.93.65:1333
tcp://95.165.99.143:61933
tcp://ams1.y.sota.sh:8080
tcp://curiosity.tdjs.tech:30003
tcp://edge.v4.hel1.devices.y.samip.fi:65444
tcp://edge.v4.tku1.devices.y.samip.fi:65444
tcp://edge.v6.hel1.devices.y.samip.fi:65444
tcp://edge.v6.tku1.devices.y.samip.fi:65444
tcp://glimmy.092918.xyz:50001
tcp://hindsight.krvtz.net:8082
tcp://lancis.iscute.moe:49273
tcp://lan.tdem.in:50001
tcp://n2o.ddns.net:22632
tcp://nessie.krvtz.net:8082
tcp://vps.tomasgl.ru:61933
tcp://yggdrasil.frank2.net:1337
tcp://ygg.loskiq.com:17313
tcp://yggnode.ddns.net:18226
tcp://yggnode.ddns.net:18228
tcp://y.zbin.eu:7743
tls://104.248.15.125:32337
tls://140.238.168.104:17121
tls://176.101.222.31:27364
tls://176.215.237.83:2756
tls://194.177.21.156:5068
tls://[2001:41d0:2:c44a:51:255:223:60]:10259
tls://[2001:41d0:401:3000::4227]:46394
tls://[2001:41d0:601:1100::cf2]:14987
tcp://[2001:470:1f13:e56::64]:39565
tls://212.129.52.193:39575
tls://217.195.164.4:10531
tls://[2604:a880:400:d0::16e5:7001]:19102
tls://[2604:a880:800:c1::2c2:a001]:32337
tls://[2a00:b700:2::6:69]:1444
tls://[2a01:d0:ffff:4353::2]:6010
tls://[2a02:1802:5e:0:18d2:e2ff:fe44:17d2]:9944
tls://[2a02:1802:5e:0:4b7:c2ff:fe29:ba37]:9944
tls://[2a02:1802:5e:0:7cc7:cdff:fe28:128a]:9944
tls://[2a02:1802:5e:0:8854:12ff:fe35:65b3]:9944
tls://[2a02:1802:5e:0:900c:33ff:fea5:7aec]:9944
tls://[2a02:1802:5e:0:b841:d3ff:feb2:9a81]:9944
tls://[2a02:1802:5e:0:b84d:bdff:fe90:1a82]:9944
tls://[2a02:1802:5e:0:bc20:44ff:fe93:6353]:9944
tls://[2a05:3580:d900:1b13:e2d5:5eff:fed8:8b86]:8778
tls://45.11.19.26:5002
tls://51.15.204.214:54321
tls://[2001:470:1f13:e56::64]:39575
tcp://94.130.203.208:5999
tcp://bunkertreff.ddns.net:5454
tcp://ygg.cofob.ru:80
tcp://yugudorashiru.de:80
tls://ygg.cofob.ru:443
tls://yugudorashiru.de:443
tcp://213.188.197.95:10010
tcp://[2a09:8280:1::3:313]:10010
tls://213.188.197.95:10020
tls://[2a09:8280:1::3:313]:10020
tls://45.147.198.155:6010
tls://46.105.92.61:46394
tls://94.103.82.150:8080
tcp://yggdrasil.frank2.net:1337
tcp://185.165.169.234:8880
tls://185.165.169.234:8443
tcp://46.151.26.194:60575
tcp://lan.tdem.in:50001
tcp://ygg-ru.cofob.ru:18000
tcp://ygg-ru2.cofob.ru:80
tcp://ygg.loskiq.dev:17313
tcp://ygg.tomasgl.ru:61933
tcp://ygg.tomasgl.ru:61933?key=c5e0c28a600c2118e986196a0bbcbda4934d8e9278ceabea48838dc5d8fae576
tcp://yggnode.cf:18226
tls://185.22.60.71:8443
tls://46.151.26.194:8443
tls://51.255.223.60:10259
tls://54.37.137.221:14987
tls://67.205.187.55:19102
tls://[2a01:d0:ffff:4353::2]:6010
tls://lan.tdem.in:50002
tls://ygg-ru.cofob.ru:18001
tls://ygg-ru2.cofob.ru:443
tls://ygg.loskiq.dev:17314
tls://ygg.tomasgl.ru:61944
tls://ygg.tomasgl.ru:61944?key=c5e0c28a600c2118e986196a0bbcbda4934d8e9278ceabea48838dc5d8fae576
tls://yggnode.cf:18227
tcp://y.zbin.eu:7743
tcp://[2a04:5b81:2010::90]:2000
tls://185.130.44.194:7040
tls://[2a07:e01:105:444:c634:6bff:feb5:6e28]:7040
tcp://140.238.168.104:17117
tls://140.238.168.104:17121
tcp://78.27.153.163:33165
tls://78.27.153.163:33166
tls://88.201.129.205:8778
tls://91.206.93.65:1444
tls://edge.v4.hel1.devices.y.samip.fi:65445
tls://edge.v4.tku1.devices.y.samip.fi:65445
tls://edge.v6.hel1.devices.y.samip.fi:65445
tls://edge.v6.tku1.devices.y.samip.fi:65445
tls://glimmy.092918.xyz:58008
tcp://curiosity.tdjs.tech:30003
tcp://213.188.199.150:10010
tcp://213.188.210.9:10010
tcp://[2a09:8280:1::3:312]:10010
tcp://[2a09:8280:1::a:2e2]:10010
tcp://lancis.iscute.moe:49273
tcp://longseason.1200bps.xyz:13121
tls://lancis.iscute.moe:49274
tls://lan.tdem.in:50002
tls://vps.tomasgl.ru:61944
tls://ygg.loskiq.com:17314
tls://yggnode.ddns.net:18227
tls://yggnode.ddns.net:18229
tls://longseason.1200bps.xyz:13122
14 changes: 6 additions & 8 deletions build
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,16 @@ fi

if [ $IOS ]; then
echo "Building framework for iOS"
gomobile bind -target ios -tags mobile -ldflags="$LDFLAGS $STRIP" -gcflags="$GCFLAGS" \
github.com/yggdrasil-network/yggdrasil-go/src/yggdrasil \
github.com/yggdrasil-network/yggdrasil-go/src/config \
go get golang.org/x/mobile/bind
gomobile bind -target ios -tags mobile -o Yggdrasil.framework -ldflags="$LDFLAGS $STRIP" -gcflags="$GCFLAGS" \
github.com/yggdrasil-network/yggdrasil-extras/src/mobile \
github.com/yggdrasil-network/yggdrasil-extras/src/dummy
github.com/yggdrasil-network/yggdrasil-go/src/config
elif [ $ANDROID ]; then
echo "Building aar for Android"
gomobile bind -target android -tags mobile -ldflags="$LDFLAGS $STRIP" -gcflags="$GCFLAGS" \
github.com/yggdrasil-network/yggdrasil-go/src/yggdrasil \
github.com/yggdrasil-network/yggdrasil-go/src/config \
go get golang.org/x/mobile/bind
gomobile bind -target android -tags mobile -o yggdrasil.aar -ldflags="$LDFLAGS $STRIP" -gcflags="$GCFLAGS" \
github.com/yggdrasil-network/yggdrasil-extras/src/mobile \
github.com/yggdrasil-network/yggdrasil-extras/src/dummy
github.com/yggdrasil-network/yggdrasil-go/src/config
else
for CMD in yggdrasil yggdrasilctl ; do
echo "Building: $CMD"
Expand Down
78 changes: 78 additions & 0 deletions cmd/genkeys/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
This file generates crypto keys.
It prints out a new set of keys each time if finds a "better" one.
By default, "better" means a higher NodeID (-> higher IP address).
This is because the IP address format can compress leading 1s in the address, to increase the number of ID bits in the address.
If run with the "-sig" flag, it generates signing keys instead.
A "better" signing key means one with a higher TreeID.
This only matters if it's high enough to make you the root of the tree.
*/
package main

import (
"crypto/ed25519"
"encoding/hex"
"fmt"
"net"
"runtime"

"github.com/yggdrasil-network/yggdrasil-go/src/address"
)

type keySet struct {
priv ed25519.PrivateKey
pub ed25519.PublicKey
}

func main() {
threads := runtime.GOMAXPROCS(0)
var currentBest ed25519.PublicKey
newKeys := make(chan keySet, threads)
for i := 0; i < threads; i++ {
go doKeys(newKeys)
}
for {
newKey := <-newKeys
if isBetter(currentBest, newKey.pub) || len(currentBest) == 0 {
currentBest = newKey.pub
fmt.Println("-----")
fmt.Println("Priv:", hex.EncodeToString(newKey.priv))
fmt.Println("Pub:", hex.EncodeToString(newKey.pub))
addr := address.AddrForKey(newKey.pub)
fmt.Println("IP:", net.IP(addr[:]).String())
}
}
}

func isBetter(oldPub, newPub ed25519.PublicKey) bool {
for idx := range oldPub {
if newPub[idx] < oldPub[idx] {
return true
}
if newPub[idx] > oldPub[idx] {
break
}
}
return false
}

func doKeys(out chan<- keySet) {
bestKey := make(ed25519.PublicKey, ed25519.PublicKeySize)
for idx := range bestKey {
bestKey[idx] = 0xff
}
for {
pub, priv, err := ed25519.GenerateKey(nil)
if err != nil {
panic(err)
}
if !isBetter(bestKey, pub) {
continue
}
bestKey = pub
out <- keySet{priv, pub}
}
}
Loading

0 comments on commit 0270fec

Please sign in to comment.