Add -ip flag to specify resolve ip address #3

Merged
merged 2 commits into from Dec 29, 2014

Conversation

Projects
None yet
2 participants
@sosedoff
Contributor

sosedoff commented Dec 28, 2014

No description provided.

@sosedoff

This comment has been minimized.

Show comment
Hide comment
@sosedoff

sosedoff Dec 29, 2014

Contributor

Had the same issue as in #2

Contributor

sosedoff commented Dec 29, 2014

Had the same issue as in #2

@robbiev

View changes

main.go
@@ -34,10 +36,18 @@ func handleRequest(w dns.ResponseWriter, r *dns.Msg) {
func main() {
var addr = flag.String("addr", "127.0.0.1:5300", "listen address")
+ var ip = flag.String("ip", "127.0.0.1", "resolve ip address")

This comment has been minimized.

@robbiev

robbiev Dec 29, 2014

Owner

maybe change to "resolve ipv4 address"

@robbiev

robbiev Dec 29, 2014

Owner

maybe change to "resolve ipv4 address"

@robbiev

View changes

main.go
+ resolveIp = net.ParseIP(*ip)
+ if resolveIp == nil {
+ log.Fatalf("Invalid ip address: %s\n", *ip)
+ }

This comment has been minimized.

@robbiev

robbiev Dec 29, 2014

Owner

Perhaps add

if resolveIp.To4() == nil {
  log.Fatalf("Invalid ipv4 address: %s\n", *ip)
}
@robbiev

robbiev Dec 29, 2014

Owner

Perhaps add

if resolveIp.To4() == nil {
  log.Fatalf("Invalid ipv4 address: %s\n", *ip)
}
@robbiev

View changes

main.go
@@ -9,6 +9,8 @@ import (
"github.com/miekg/dns"
)
+var resolveIp net.IP

This comment has been minimized.

@robbiev

robbiev Dec 29, 2014

Owner

rename to resolveIP (IP in caps, which is more common go style)

@robbiev

robbiev Dec 29, 2014

Owner

rename to resolveIP (IP in caps, which is more common go style)

@robbiev

This comment has been minimized.

Show comment
Hide comment
@robbiev

robbiev Dec 29, 2014

Owner

Thanks! Added a few comments - mostly related to restricting to ipv4 given that the DNS resolver code only supports A records.

Owner

robbiev commented Dec 29, 2014

Thanks! Added a few comments - mostly related to restricting to ipv4 given that the DNS resolver code only supports A records.

@sosedoff

This comment has been minimized.

Show comment
Hide comment
@sosedoff

sosedoff Dec 29, 2014

Contributor

@robbiev changes are in

Contributor

sosedoff commented Dec 29, 2014

@robbiev changes are in

robbiev added a commit that referenced this pull request Dec 29, 2014

Merge pull request #3 from sosedoff/changeable-ip
Add -ip flag to specify resolve ip address

@robbiev robbiev merged commit 891032a into robbiev:master Dec 29, 2014

@robbiev

This comment has been minimized.

Show comment
Hide comment
@robbiev

robbiev Dec 29, 2014

Owner

Thanks, I will upload a new release binary soon.

Owner

robbiev commented Dec 29, 2014

Thanks, I will upload a new release binary soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment