Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix any-sync-netcheck; bump go dependency #19

Merged
merged 2 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 64 additions & 9 deletions any-sync-netcheck/netcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,30 +23,76 @@ import (
"storj.io/drpc/drpcconn"
"strings"
"time"
"os"
"gopkg.in/yaml.v3"
)

type ConfigFile struct {
Id string `yaml:"id"`
NetworkId string `yaml:"networkId"`
Nodes []Node `yaml:"nodes"`
}

type Node struct {
Addresses []string `yaml:"addresses"`
PeerId string `yaml:"peerId"`
Types []string `yaml:"types"`
}

var ctx = context.Background()

var log = logger.NewNamed("netcheck")

var defaultAddrs = `
yamux://prod-any-sync-coordinator1.anyclub.org:443,
yamux://prod-any-sync-coordinator1.anyclub.org:1443,
yamux://prod-any-sync-coordinator1.toolpad.org:443,
yamux://prod-any-sync-coordinator1.toolpad.org:1443,
quic://prod-any-sync-coordinator1.toolpad.org:5430
yamux://prod-any-sync-coordinator1.anytype.io:443,
yamux://prod-any-sync-coordinator1.anytype.io:1443,
quic://prod-any-sync-coordinator1.anyclub.org:5430
`

var (
verbose = flag.Bool("v", false, "verbose logs")
addrs = flag.String("addrs", defaultAddrs, "comma separated list of addrs")
verbose = flag.Bool("v", false, "verbose logs")
addrs = flag.String("addrs", defaultAddrs, "comma separated list of addrs")
clientYml = flag.String("c", "", "path to client.yml file")
)

func main() {
flag.Parse()

logger.SetNamedLevels(logger.LevelsFromStr("*=INFO"))
if *verbose {
logger.SetNamedLevels(logger.LevelsFromStr("*=DEBUG"))
}

var checkAddrs []string
if *clientYml != "" {
file, err := os.ReadFile(*clientYml)
if err != nil {
log.Fatal("cannot read client.yml", zap.Error(err))
}

var configFile ConfigFile
if err := yaml.Unmarshal(file, &configFile); err != nil {
log.Fatal("cannot unmarshal client.yml", zap.Error(err))
}

for _, node := range configFile.Nodes {
for _, t := range node.Types {
if t == "coordinator" {
for _, address := range node.Addresses {
if !strings.HasPrefix(address, "quic://") {
address = "yamux://" + address
}
checkAddrs = append(checkAddrs, address)
}
}
}
}
} else {
logger.SetNamedLevels(logger.LevelsFromStr("*=INFO"))
checkAddrs = strings.Split(*addrs, ",")
}

info, err := goInfo.GetInfo()
Expand All @@ -55,26 +101,27 @@ func main() {
} else {
info.VarDump()
}

a := new(app.App)
bootstrap(a)
if err := a.Start(ctx); err != nil {
panic(err)
}

checkAddrs := strings.Split(*addrs, ",")

for _, addr := range checkAddrs {
addr = strings.TrimSpace(addr)
if strings.HasPrefix(addr, "yamux://") {
switch {
case strings.HasPrefix(addr, "yamux://"):
probeYamux(a, addr[8:])
} else if strings.HasPrefix(addr, "quic://") {
case strings.HasPrefix(addr, "quic://"):
probeQuic(a, addr[7:])
} else {
default:
log.Warn("unexpected address scheme", zap.String("addr", addr))
}
}
}


func probeYamux(a *app.App, addr string) {
ss := a.MustComponent(secureservice.CName).(secureservice.SecureService)
l := log.With(zap.String("addr", addr))
Expand Down Expand Up @@ -260,6 +307,14 @@ func (n nodeConf) CoordinatorPeers() []string {
return nil
}

func (n nodeConf) NamingNodePeers() []string {
return nil
}

func (n nodeConf) PaymentProcessingNodePeers() []string {
return nil
}

func (n nodeConf) PeerAddresses(peerId string) (addrs []string, ok bool) {
return nil, false
}
Expand Down
77 changes: 45 additions & 32 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,78 +1,91 @@
module github.com/anyproto/any-sync-tools

go 1.19
go 1.22

require (
github.com/AlecAivazis/survey/v2 v2.3.7
github.com/anyproto/any-sync v0.3.1
github.com/anyproto/any-sync v0.4.17
github.com/anyproto/go-chash v0.1.0
github.com/hashicorp/yamux v0.1.1
github.com/matishsiao/goInfo v0.0.0-20210923090445-da2e3fa8d45f
github.com/spf13/cobra v1.7.0
go.uber.org/zap v1.26.0
golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63
github.com/spf13/cobra v1.8.0
go.uber.org/zap v1.27.0
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22
gopkg.in/yaml.v3 v3.0.1
storj.io/drpc v0.0.33
storj.io/drpc v0.0.34
)

require (
filippo.io/edwards25519 v1.0.0 // indirect
filippo.io/edwards25519 v1.1.0 // indirect
github.com/anyproto/go-slip10 v1.0.0 // indirect
github.com/anyproto/go-slip21 v1.0.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.10.0 // indirect
github.com/btcsuite/btcd v0.22.1 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 // indirect
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/consensys/bavard v0.1.13 // indirect
github.com/consensys/gnark-crypto v0.12.1 // indirect
github.com/crate-crypto/go-kzg-4844 v0.7.0 // indirect
github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/ethereum/c-kzg-4844 v0.4.0 // indirect
github.com/ethereum/go-ethereum v1.13.15 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/pprof v0.0.0-20230817174616-7a8ec2ada47b // indirect
github.com/google/pprof v0.0.0-20240402174815-29b9bb013b0f // indirect
github.com/holiman/uint256 v1.2.4 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/ipfs/go-cid v0.4.1 // indirect
github.com/ipfs/go-log/v2 v2.5.1 // indirect
github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/libp2p/go-libp2p v0.31.0 // indirect
github.com/mattn/go-colorable v0.1.2 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/libp2p/go-libp2p v0.33.2 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
github.com/miguelmota/go-ethereum-hdwallet v0.1.2 // indirect
github.com/minio/sha256-simd v1.0.1 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/multiformats/go-base32 v0.1.0 // indirect
github.com/multiformats/go-base36 v0.2.0 // indirect
github.com/multiformats/go-multiaddr v0.11.0 // indirect
github.com/multiformats/go-multiaddr v0.12.3 // indirect
github.com/multiformats/go-multibase v0.2.0 // indirect
github.com/multiformats/go-multicodec v0.9.0 // indirect
github.com/multiformats/go-multihash v0.2.3 // indirect
github.com/multiformats/go-multistream v0.4.1 // indirect
github.com/multiformats/go-multistream v0.5.0 // indirect
github.com/multiformats/go-varint v0.0.7 // indirect
github.com/onsi/ginkgo/v2 v2.11.0 // indirect
github.com/prometheus/client_golang v1.16.0 // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.11.1 // indirect
github.com/quic-go/qtls-go1-20 v0.3.3 // indirect
github.com/quic-go/quic-go v0.38.1 // indirect
github.com/onsi/ginkgo/v2 v2.17.1 // indirect
github.com/prometheus/client_golang v1.19.1 // indirect
github.com/prometheus/client_model v0.6.0 // indirect
github.com/prometheus/common v0.48.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/quic-go/quic-go v0.43.1 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/supranational/blst v0.3.11 // indirect
github.com/tyler-smith/go-bip39 v1.1.0 // indirect
github.com/zeebo/errs v1.3.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/mock v0.4.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.13.0 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/net v0.15.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/term v0.12.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/tools v0.12.1-0.20230815132531-74c255bcf846 // indirect
google.golang.org/protobuf v1.31.0 // indirect
golang.org/x/crypto v0.23.0 // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/term v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
golang.org/x/tools v0.21.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
lukechampine.com/blake3 v1.2.1 // indirect
rsc.io/tmplfunc v0.0.3 // indirect
)
Loading
Loading