Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DNSServer ¶
type DNSServer interface { Listen() Query(Packet) }
DNSServer will do Listen, Query and Send.
type DNSService ¶
type DNSService struct {
// contains filtered or unexported fields
}
DNSService is an implementation of DNSServer interface.
func New ¶
func New(rwDirPath, listenAddr string, sendAddr string, forwarder net.UDPAddr) DNSService
New setups a DNSService, rwDirPath is read-writable directory path for storing dns records.
func Start ¶
func Start(rwDirPath, listenAddr, sendAddr string, forwarder net.UDPAddr) *DNSService
Start conveniently init every parts of DNS service.
func (*DNSService) Query ¶
func (s *DNSService) Query(p Packet)
Query lookup answers for DNS message.
type Packet ¶
type Packet struct {
// contains filtered or unexported fields
}
Packet carries DNS packet payload and sender address.
type RestServer ¶
type RestServer interface { Create() http.HandlerFunc Read() http.HandlerFunc Update() http.HandlerFunc Delete() http.HandlerFunc }
RestServer will do CRUD on DNS records
type RestService ¶
type RestService struct {
Dn *DNSService
}
RestService is an implementation of RestServer interface.
func (*RestService) Create ¶
func (s *RestService) Create(w http.ResponseWriter, r *http.Request)
Create is HTTP handler of POST request. Use for adding new record to DNS server.
func (*RestService) Delete ¶
func (s *RestService) Delete(w http.ResponseWriter, r *http.Request)
Delete is HTTP handler of DELETE request. Use for removing records on DNS server.
func (*RestService) Read ¶
func (s *RestService) Read(w http.ResponseWriter, r *http.Request)
Read is HTTP handler of GET request. Use for reading existed records on DNS server.
func (*RestService) Update ¶
func (s *RestService) Update(w http.ResponseWriter, r *http.Request)
Update is HTTP handler of PUT request. Use for updating existed records on DNS server.