config: rename --url argument to --ice-url

Signed-off-by: Steffen Vogel <post@steffenvogel.de>
This commit is contained in:
Steffen Vogel
2022-10-05 22:13:01 +02:00
parent 0248253f15
commit 548884940c
4 changed files with 10 additions and 10 deletions

View File

@@ -46,7 +46,7 @@ var _ = Describe("Agent config", func() {
Expect(aCfg.Urls).To(ContainElements(exp))
}
},
Entry("url1", []string{"--url", "stun:server1", "--username", "user1", "--password", "pass1"}, &ice.URL{
Entry("url1", []string{"--ice-url", "stun:server1", "--username", "user1", "--password", "pass1"}, &ice.URL{
Scheme: ice.SchemeTypeSTUN,
Host: "server1",
Port: 3478,
@@ -54,7 +54,7 @@ var _ = Describe("Agent config", func() {
Username: "user1",
Password: "pass1",
}),
Entry("url2", []string{"--url", "turn:server2:1234?transport=tcp", "--username", "user1", "--password", "pass1"}, &ice.URL{
Entry("url2", []string{"--ice-url", "turn:server2:1234?transport=tcp", "--username", "user1", "--password", "pass1"}, &ice.URL{
Scheme: ice.SchemeTypeTURN,
Host: "server2",
Port: 1234,
@@ -62,7 +62,7 @@ var _ = Describe("Agent config", func() {
Username: "user1",
Password: "pass1",
}),
Entry("url3", []string{"--url", "turn:user3:pass3@server3:1234?transport=tcp", "--password", "pass3"}, &ice.URL{
Entry("url3", []string{"--ice-url", "turn:user3:pass3@server3:1234?transport=tcp", "--password", "pass3"}, &ice.URL{
Scheme: ice.SchemeTypeTURN,
Host: "server3",
Port: 1234,
@@ -70,8 +70,8 @@ var _ = Describe("Agent config", func() {
Username: "user3",
Password: "pass3",
}),
Entry("url3", []string{"--password", "pass1", "--url", "http://bla.0l.de"}, "failed to gather ICE URLs: invalid ICE URL scheme: http"),
Entry("url4", []string{"--url", "stun:stun.cunicu.li?transport=tcp"}, "failed to gather ICE URLs: failed to parse STUN/TURN URL 'stun:stun.cunicu.li?transport=tcp': queries not supported in stun address"),
Entry("url3", []string{"--password", "pass1", "--ice-url", "http://bla.0l.de"}, "failed to gather ICE URLs: invalid ICE URL scheme: http"),
Entry("url4", []string{"--ice-url", "stun:stun.cunicu.li?transport=tcp"}, "failed to gather ICE URLs: failed to parse STUN/TURN URL 'stun:stun.cunicu.li?transport=tcp': queries not supported in stun address"),
)
Context("can get ICE URLs from relay API", func() {
@@ -113,7 +113,7 @@ var _ = Describe("Agent config", func() {
})
It("can get list of relays", func() {
cfg, err := config.ParseArgs("--url", fmt.Sprintf("grpc://localhost:%d?insecure=true", port))
cfg, err := config.ParseArgs("--ice-url", fmt.Sprintf("grpc://localhost:%d?insecure=true", port))
Expect(err).To(Succeed())
ctx := context.Background()

View File

@@ -93,7 +93,7 @@ func New(flags *pflag.FlagSet) *Config {
flags.IntP("routing-table", "T", DefaultRouteTable, "Kernel routing table to use")
// Endpoint discovery
flags.StringSliceP("url", "a", []string{}, "One or more `URL`s of STUN and/or TURN servers")
flags.StringSliceP("ice-url", "a", []string{}, "One or more `URL`s of STUN and/or TURN servers")
flags.StringP("username", "u", "", "The `username` for STUN/TURN credentials")
flags.StringP("password", "p", "", "The `password` for STUN/TURN credentials")

View File

@@ -89,7 +89,7 @@ var _ = Context("config", func() {
})
It("fails on invalid arguments values", func() {
_, err := config.ParseArgs("--url", ":_")
_, err := config.ParseArgs("--ice-url", ":_")
Expect(err).To(MatchError(HaveSuffix("missing protocol scheme")))
})
@@ -263,7 +263,7 @@ var _ = Context("config", func() {
BeforeEach(func() {
var err error
args := []string{"--ice-network-type", "udp4,udp6", "--url", "stun:stun.cunicu.de", "wg0"}
args := []string{"--ice-network-type", "udp4,udp6", "--ice-url", "stun:stun.cunicu.de", "wg0"}
cfg1, err = config.ParseArgs(args...)
Expect(err).To(Succeed())

View File

@@ -123,7 +123,7 @@ func (n *Network) AgentArgs() []any {
for _, r := range n.RelayNodes {
for _, u := range r.URLs() {
extraArgs = append(extraArgs, "--url", u)
extraArgs = append(extraArgs, "--ice-url", u)
}
}