diff --git a/cmd/skywire-cli/commands/mdisc/root.go b/cmd/skywire-cli/commands/mdisc/root.go index b500045f04..8e28410a74 100644 --- a/cmd/skywire-cli/commands/mdisc/root.go +++ b/cmd/skywire-cli/commands/mdisc/root.go @@ -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. diff --git a/cmd/skywire-cli/commands/node/gen-config.go b/cmd/skywire-cli/commands/node/gen-config.go index e641d37040..0a0ff9d590 100644 --- a/cmd/skywire-cli/commands/node/gen-config.go +++ b/cmd/skywire-cli/commands/node/gen-config.go @@ -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" ) @@ -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" @@ -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)) @@ -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" diff --git a/cmd/skywire-cli/commands/rtfind/root.go b/cmd/skywire-cli/commands/rtfind/root.go index a05f9502d3..f7a26f2269 100644 --- a/cmd/skywire-cli/commands/rtfind/root.go +++ b/cmd/skywire-cli/commands/rtfind/root.go @@ -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") diff --git a/cmd/skywire-cli/commands/tpdisc/root.go b/cmd/skywire-cli/commands/tpdisc/root.go index 7dbe67a270..5d27f95cf8 100644 --- a/cmd/skywire-cli/commands/tpdisc/root.go +++ b/cmd/skywire-cli/commands/tpdisc/root.go @@ -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") } diff --git a/cmd/skywire-cli/internal/internal.go b/cmd/skywire-cli/internal/internal.go index e79539cea0..62f59624d2 100644 --- a/cmd/skywire-cli/internal/internal.go +++ b/cmd/skywire-cli/internal/internal.go @@ -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" +)