Documentation ¶
Index ¶
- Constants
- func GetTimer(t time.Duration) *time.Timer
- func Load(key string) (interface{}, bool)
- func Put(key string, data interface{}, ttl time.Duration)
- func ReadMsgFromTCP(c io.Reader) (m *dns.Msg, n int, err error)
- func ReadMsgFromUDP(c io.Reader, bufSize int) (m *dns.Msg, n int, err error)
- func ReadUDPMsgFrom(c net.PacketConn, bufSize int) (m *dns.Msg, from net.Addr, n int, err error)
- func ReleaseTimer(timer *time.Timer)
- func Remove(key string)
- func ResetAndDrainTimer(timer *time.Timer, d time.Duration)
- func WriteMsgToTCP(c io.Writer, m *dns.Msg) (n int, err error)
- func WriteMsgToUDP(c io.Writer, m *dns.Msg) (n int, err error)
- func WriteRawMsgToTCP(c io.Writer, b []byte) (n int, err error)
- func WriteRawMsgToUDP(c io.Writer, b []byte) (n int, err error)
- func WriteUDPMsgTo(m *dns.Msg, c net.PacketConn, to net.Addr) (n int, err error)
- type LoadOnceCache
Constants ¶
View Source
const ( IPv4UdpMaxPayload = 1472 // MTU 1500 - 20 IPv4 header - 8 udp header IPv6UdpMaxPayload = 1452 // MTU 1500 - 40 IPv6 header - 8 udp header )
Variables ¶
This section is empty.
Functions ¶
func ReadMsgFromTCP ¶ added in v1.4.4
ReadMsgFromTCP reads msg from a tcp connection. brokenDataLeft indicates the frame size which have not be read from c. if brokenDataLeft is unknownBrokenDataSize(-1), c should not be reused anymore. n represents how many bytes are read from c.
func ReadMsgFromUDP ¶ added in v1.4.4
func ReadUDPMsgFrom ¶ added in v1.4.4
func ReleaseTimer ¶ added in v1.5.5
func ResetAndDrainTimer ¶ added in v1.5.5
func WriteMsgToTCP ¶ added in v1.4.4
WriteMsgToTCP writes m to c. n represents how many bytes are wrote to c. This includes 2 bytes tcp length header.
func WriteRawMsgToTCP ¶ added in v1.4.4
WriteRawMsgToTCP writes b to c. n represents how many bytes are wrote to c. This includes 2 bytes tcp length header.
func WriteRawMsgToUDP ¶ added in v1.4.4
func WriteUDPMsgTo ¶ added in v1.4.4
Types ¶
type LoadOnceCache ¶ added in v1.5.5
type LoadOnceCache struct {
// contains filtered or unexported fields
}
func NewCache ¶ added in v1.5.5
func NewCache() *LoadOnceCache
func (*LoadOnceCache) Load ¶ added in v1.5.5
func (c *LoadOnceCache) Load(key string) (interface{}, bool)
func (*LoadOnceCache) Put ¶ added in v1.5.5
func (c *LoadOnceCache) Put(key string, data interface{}, ttl time.Duration)
func (*LoadOnceCache) Remove ¶ added in v1.5.5
func (c *LoadOnceCache) Remove(key string)
Click to show internal directories.
Click to hide internal directories.