Comments (8)
[ Quoting <reply+i-4392099-43bc40389> in "[dns] DNS Server - panic: runtime e..." ]
I'm running Go 1.0.1.
When run the "reflect" example and them I run a nmap UDP port scan (
nmap -sU localhost
), the following error success (complete output log):panic: runtime error: index out of range
Thanks for your report. I believe this is fixed in the latest Git version of
dns.
grtz Miek
from dns.
Thanks Miek for your fast support!
In other context, I'm looking for an easy example for implement a DNS server parsing zones files, so I'm newbie with Go and I don't know how to use some functionalities and the API.
You can provide another easy example about how to make this?
Thanks a lot again!
from dns.
[ Quoting <reply+i-4392099-43bc40389> in "Re: [dns] DNS Server - panic: runti..." ]
Thanks Miek for your fast support!
In other context, I'm looking for an easy example for implement a DNS server
parsing zones files, so I'm newbie with Go and I don't know how to use some
functionalities and the API.
You'll need a simple server that reads and parses a single zonefile? I can make
a example for that. A more complete nameserver is more difficult as Go dns does
not has a zone structure -- I might add that, but I'm still looking for a fast
tree structure for that.
For reading zone files you can use: ParseZone and of course
ex/reflect/reflect.go is a simple nameserver in itself.
Regards,
Miek Gieben
from dns.
A basic example helps a lot!
So, I just need to insert the next code into reflec.go for implement the zone parsing?
zone := `$ORIGIN .
$TTL 3600 ; 1 hour
name IN SOA a6.nstld.com. hostmaster.nic.name. (
203362132 ; serial
300 ; refresh (5 minutes)
300 ; retry (5 minutes)
1209600 ; expire (2 weeks)
300 ; minimum (5 minutes)
)
$TTL 10800 ; 3 hours
@ 10800 IN NS @
IN NS g6.nstld.com.
7200 NS h6.nstld.com.
3600 IN NS j6.nstld.com.
IN 3600 NS k6.nstld.com.
NS l6.nstld.com.
NS a6.nstld.com.
NS c6.nstld.com.
NS d6.nstld.com.
NS f6.nstld.com.
NS m6.nstld.com.
$ORIGIN name.
0-0onlus NS ns7.ehiweb.it.
NS ns8.ehiweb.it.
0-g MX 10 mx01.nic
MX 10 mx02.nic
MX 10 mx03.nic
MX 10 mx04.nic
TXT "10 mx\"04.nic"
$ORIGIN 0-g.name
moutamassey NS ns01.yahoodomains.jp.
NS ns02.yahoodomains.jp.
`
to := ParseZone(strings.NewReader(zone), "", "testzone")
from dns.
[ Quoting <reply+i-4392099-43bc40389> in "Re: [dns] DNS Server - panic: runti..." ]
A basic example helps a lot!
So, I just need to insert the next code into reflec.go for implement the zone parsing?
almost.
zone := `$ORIGIN . $TTL 3600 ; 1 hour name IN SOA a6.nstld.com. hostmaster.nic.name. ( 203362132 ; serial 300 ; refresh (5 minutes) 300 ; retry (5 minutes) 1209600 ; expire (2 weeks) 300 ; minimum (5 minutes) ) $TTL 10800 ; 3 hours @ 10800 IN NS @ IN NS g6.nstld.com. 7200 NS h6.nstld.com. 3600 IN NS j6.nstld.com. IN 3600 NS k6.nstld.com. NS l6.nstld.com. NS a6.nstld.com. NS c6.nstld.com. NS d6.nstld.com. NS f6.nstld.com. NS m6.nstld.com. $ORIGIN name. 0-0onlus NS ns7.ehiweb.it. NS ns8.ehiweb.it. 0-g MX 10 mx01.nic MX 10 mx02.nic MX 10 mx03.nic MX 10 mx04.nic TXT "10 mx\"04.nic" $ORIGIN 0-g.name moutamassey NS ns01.yahoodomains.jp. NS ns02.yahoodomains.jp. ` to := ParseZone(strings.NewReader(zone), "", "testzone")
(also see parse_test the ExampleZone() function.
You'll need to add:
// Get the RRs from the zone being read
for x := range to {
if x.Error == nil {
// Print is for now
fmt.Printf("%s\n", x.RR)
} else {
// Error occured, just continue?
}
}
Resource record lookups and combining RRs to RRsets is not implemented. This is
sorta on the TODO.
Regards,
Miek Gieben
from dns.
Thanks a lot again!
I added the above code,to the reflec example and then I try to compile it, but fails with the following error:
./reflect.go:113: undefined: ParseZone
I just want to load a zone to serve via the DNS server instance, so I'm newbie with Go and I don't understand the library API.
Please, you can provide an example about how to create a simple DNS server parsing zones from variables or files?
I think, at least for Go not experimented users, a well API documentation and some more examples will be really helpful.
Thanks a lot for your time and patience :)
from dns.
[ Quoting <reply+i-4392099-43bc40389> in "Re: [dns] DNS Server - panic: runti..." ]
Thanks a lot again!
I added the above code,to the reflec example and then I try to compile it, but fail with the following error:
./reflect.go:113: undefined: ParseZone
dns.ParseZone
you need to prefix the funcion with the package name, in this case "dns".
I just want to load a zone the serve via the DNS server instance, so I'm newbie with Go and I don't understand the library API.
Please, you can provide an example about how to create a simple DNS server parsing zones from variables or files?
This is on my TODO, but I'm strapped for time, so I don't know when this will
happen.
I think, at least for Go not experimented users, a well API documentation and some more examples will be really helpful.
There is a lot of documentation there, and also in the ex/ directory you'll find
more (client)side examples. Learning Go and learning DNS at the same time may
not be the most efficient way to learn Go :)
Are you aware of miek.nl/files/go with copies of "Learning Go"?
What documentation do you need, besides a complete nameserver :) ?
Regards,
Miek Gieben
from dns.
Thanks a lot Miek :)
I will take a look to your book for learning the bases of Go, a then I try again to use your library.
Congratulations for your book and code, is really amazing :)
Cheers!
from dns.
Related Issues (20)
- $INCLUDE and relative paths HOT 2
- Some question on rndc command
- Decoding of some "special" characters results in \DDD+ HOT 1
- Optional interface for a ResponseWriter to expose Conns HOT 3
- Expose SVCB Service Params fully to clients HOT 2
- Corner case where offset is equal to len(msg), response is truncated without TC bit set and no error is raised HOT 1
- Method for creating wire-format dns.Header from *dns.Msg? HOT 2
- [Query] Type65 aka HTTPS HOT 2
- RFC 2136: Dynamic updates HOT 3
- Add isdn record HOT 1
- Message pack and unpack fails with an empty name in a RR header HOT 1
- Duplicate DNS rCode? HOT 2
- dns: overflow unpacking uint16 HOT 2
- Can't retrieve TXT records for some domains HOT 1
- Trailing backslash results in non-FQDN targets HOT 6
- RFC: Parsing record contents directly HOT 6
- Wildcard domains as per RFC-4592 HOT 10
- digest type 3 (GOST94) HOT 2
- Forwarding DNS Queries to other Handler in TCP Connections HOT 6
- Request timeout middleware dns.HandlerFunc HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dns.