Skip to content

Commit

Permalink
Make cli use correct addresses.
Browse files Browse the repository at this point in the history
  • Loading branch information
Evan Lin committed Sep 26, 2019
1 parent 138b6d7 commit dbc3927
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion cmd/skywire-cli/commands/mdisc/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
var mdAddr string

func init() {
RootCmd.PersistentFlags().StringVar(&mdAddr, "addr", "https://messaging.discovery.skywire.skycoin.net", "address of messaging discovery server")
RootCmd.PersistentFlags().StringVar(&mdAddr, "addr", internal.DefaultDmsgDisc, "address of messaging discovery server")
}

// RootCmd is the command that contains sub-commands which interacts with messaging services.
Expand Down
18 changes: 6 additions & 12 deletions cmd/skywire-cli/commands/node/gen-config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/SkycoinProject/dmsg/cipher"
"github.com/spf13/cobra"

"github.com/SkycoinProject/skywire-mainnet/cmd/skywire-cli/internal"
"github.com/SkycoinProject/skywire-mainnet/pkg/util/pathutil"
"github.com/SkycoinProject/skywire-mainnet/pkg/visor"
)
Expand Down Expand Up @@ -74,13 +75,6 @@ func localConfig() *visor.Config {
return c
}

const (
DefaultTpDisc = "http://transport.discovery.skywire.cc"
DefaultDmsgDisc = "http://dmsg.discovery.skywire.cc"
DefaultRouteFinder = "http://routefinder.skywire.cc"
DefaultSetupPK = "026c5a07de617c5c488195b76e8671bf9e7ee654d0633933e202af9e111ffa358d"
)

func defaultConfig() *visor.Config {
conf := &visor.Config{}
conf.Version = "1.0"
Expand All @@ -89,7 +83,7 @@ func defaultConfig() *visor.Config {
conf.Node.StaticPubKey = pk
conf.Node.StaticSecKey = sk

conf.Messaging.Discovery = DefaultDmsgDisc
conf.Messaging.Discovery = internal.DefaultDmsgDisc
conf.Messaging.ServerCount = 1

passcode := base64.StdEncoding.EncodeToString(cipher.RandByte(8))
Expand All @@ -100,15 +94,15 @@ func defaultConfig() *visor.Config {
}
conf.TrustedNodes = []cipher.PubKey{}

conf.Transport.Discovery = DefaultTpDisc
conf.Transport.Discovery = internal.DefaultTpDisc
conf.Transport.LogStore.Type = "file"
conf.Transport.LogStore.Location = "./skywire/transport_logs"

conf.Routing.RouteFinder = DefaultRouteFinder
conf.Routing.RouteFinder = internal.DefaultRouteFinder

sPK := cipher.PubKey{}
if err := sPK.UnmarshalText([]byte(DefaultSetupPK)); err != nil {
log.WithError(err).Warnf("Failed to unmarshal default setup node public key %s", DefaultSetupPK)
if err := sPK.UnmarshalText([]byte(internal.DefaultSetupPK)); err != nil {
log.WithError(err).Warnf("Failed to unmarshal default setup node public key %s", internal.DefaultSetupPK)
}
conf.Routing.SetupNodes = []cipher.PubKey{sPK}
conf.Routing.Table.Type = "boltdb"
Expand Down
2 changes: 1 addition & 1 deletion cmd/skywire-cli/commands/rtfind/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var frMinHops, frMaxHops uint16
var timeout time.Duration

func init() {
RootCmd.Flags().StringVar(&frAddr, "addr", "https://routefinder.skywire.skycoin.net", "address in which to contact route finder service")
RootCmd.Flags().StringVar(&frAddr, "addr", internal.DefaultRouteFinder, "address in which to contact route finder service")
RootCmd.Flags().Uint16Var(&frMinHops, "min-hops", 1, "min hops for the returning routeFinderRoutesCmd")
RootCmd.Flags().Uint16Var(&frMaxHops, "max-hops", 1000, "max hops for the returning routeFinderRoutesCmd")
RootCmd.Flags().DurationVar(&timeout, "timeout", 10*time.Second, "timeout for remote server requests")
Expand Down
2 changes: 1 addition & 1 deletion cmd/skywire-cli/commands/tpdisc/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var (
)

func init() {
RootCmd.Flags().StringVar(&addr, "addr", "https://transport.discovery.skywire.skycoin.net", "address of transport discovery")
RootCmd.Flags().StringVar(&addr, "addr", internal.DefaultTpDisc, "address of transport discovery")
RootCmd.Flags().Var(&tpID, "id", "if specified, obtains a single transport of given ID")
RootCmd.Flags().Var(&tpPK, "pk", "if specified, obtains transports associated with given public key")
}
Expand Down
7 changes: 7 additions & 0 deletions cmd/skywire-cli/internal/internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,10 @@ func ParseUUID(name, v string) uuid.UUID {
Catch(err, fmt.Sprintf("failed to parse <%s>:", name))
return id
}

const (
DefaultTpDisc = "http://transport.discovery.skywire.cc"
DefaultDmsgDisc = "http://dmsg.discovery.skywire.cc"
DefaultRouteFinder = "http://routefinder.skywire.cc"
DefaultSetupPK = "026c5a07de617c5c488195b76e8671bf9e7ee654d0633933e202af9e111ffa358d"
)

0 comments on commit dbc3927

Please sign in to comment.