Add check for port at the end (#142)
continuous-integration/drone/push Build is passing Details

Fixes #141

Before, a failure would add on the port, eg.
```
127.0.0.1:53
127.0.0.1:53:53
127.0.0.1:53:53:53 // Go actually thinks this is now an IPv6 address, interesting
```

Now a check is added so this doesn't happen

Reviewed-on: #142
Reviewed-by: grumbulon <grumbulon@grumbulon.xyz>
This commit is contained in:
Sam Therapy 2022-10-16 14:25:13 +00:00
parent bf0e44e80c
commit b80219019e
Signed by: Froth Git
GPG Key ID: 5D8CD75CC6B79913
2 changed files with 8 additions and 3 deletions

View File

@ -141,7 +141,6 @@ local release() = {
from_secret: 'DRONE_TOKEN',
},
},
fork: true,
repositories: [
'packages/awl',
],

View File

@ -36,7 +36,10 @@ func LoadResolver(opts *util.Options) (Resolver, error) {
}, nil
case opts.QUIC:
opts.Logger.Info("loading DNS-over-QUIC resolver")
opts.Request.Server = net.JoinHostPort(opts.Request.Server, strconv.Itoa(opts.Request.Port))
if !strings.HasSuffix(opts.Request.Server, ":"+strconv.Itoa(opts.Request.Port)) {
opts.Request.Server = net.JoinHostPort(opts.Request.Server, strconv.Itoa(opts.Request.Port))
}
return &QUICResolver{
opts: opts,
@ -53,7 +56,10 @@ func LoadResolver(opts *util.Options) (Resolver, error) {
}, nil
default:
opts.Logger.Info("loading standard/DNS-over-TLS resolver")
opts.Request.Server = net.JoinHostPort(opts.Request.Server, strconv.Itoa(opts.Request.Port))
if !strings.HasSuffix(opts.Request.Server, ":"+strconv.Itoa(opts.Request.Port)) {
opts.Request.Server = net.JoinHostPort(opts.Request.Server, strconv.Itoa(opts.Request.Port))
}
return &StandardResolver{
opts: opts,