From 8396dc2fdb90711ba3394b975347a262afe22ae7 Mon Sep 17 00:00:00 2001 From: Eugene Bujak Date: Wed, 5 Dec 2018 12:52:23 +0300 Subject: [PATCH] Update docs for formatting in godoc. --- dnsforward/dnsforward.go | 13 +++++++------ dnsforward/upstream_pool.go | 28 ++++++++++++++-------------- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/dnsforward/dnsforward.go b/dnsforward/dnsforward.go index e5d2eb55..155255a8 100644 --- a/dnsforward/dnsforward.go +++ b/dnsforward/dnsforward.go @@ -13,13 +13,14 @@ import ( "github.com/miekg/dns" ) -// Server is the main way to start a DNS server +// Server is the main way to start a DNS server. +// // Example: -// s := dnsforward.Server{} -// err := s.Start(nil) // will start a DNS server listening on default port 53, in a goroutine -// err := s.Reconfigure(ServerConfig{UDPListenAddr: &net.UDPAddr{Port: 53535}}) // will reconfigure running DNS server to listen on UDP port 53535 -// err := s.Stop() // will stop listening on port 53535 and cancel all goroutines -// err := s.Start(nil) // will start listening again, on port 53535, in a goroutine +// s := dnsforward.Server{} +// err := s.Start(nil) // will start a DNS server listening on default port 53, in a goroutine +// err := s.Reconfigure(ServerConfig{UDPListenAddr: &net.UDPAddr{Port: 53535}}) // will reconfigure running DNS server to listen on UDP port 53535 +// err := s.Stop() // will stop listening on port 53535 and cancel all goroutines +// err := s.Start(nil) // will start listening again, on port 53535, in a goroutine // // The zero Server is empty and ready for use. type Server struct { diff --git a/dnsforward/upstream_pool.go b/dnsforward/upstream_pool.go index 9756d54f..f944e695 100644 --- a/dnsforward/upstream_pool.go +++ b/dnsforward/upstream_pool.go @@ -10,22 +10,22 @@ import ( "github.com/joomcode/errorx" ) -// upstream TLS pool. +// Upstream TLS pool. // // Example: -// pool := TLSPool{Address: "tls://1.1.1.1:853"} -// netConn, err := pool.Get() -// if err != nil {panic(err)} -// c := dns.Conn{Conn: netConn} -// q := dns.Msg{} -// q.SetQuestion("google.com.", dns.TypeA) -// log.Println(q) -// err = c.WriteMsg(&q) -// if err != nil {panic(err)} -// r, err := c.ReadMsg() -// if err != nil {panic(err)} -// log.Println(r) -// pool.Put(c.Conn) +// pool := TLSPool{Address: "tls://1.1.1.1:853"} +// netConn, err := pool.Get() +// if err != nil {panic(err)} +// c := dns.Conn{Conn: netConn} +// q := dns.Msg{} +// q.SetQuestion("google.com.", dns.TypeA) +// log.Println(q) +// err = c.WriteMsg(&q) +// if err != nil {panic(err)} +// r, err := c.ReadMsg() +// if err != nil {panic(err)} +// log.Println(r) +// pool.Put(c.Conn) type TLSPool struct { Address string parsedAddress *url.URL