Source File
net.go
Belonging Package
net
package net
import (
)
Close() error
LocalAddr() Addr
RemoteAddr() Addr
Close() error
LocalAddr() Addr
func () int {
listenerBacklogCache.Do(func() { listenerBacklogCache.val = maxListenerBacklog() })
return listenerBacklogCache.val
}
Close() error
Addr() Addr
}
errNoSuitableAddress = errors.New("no suitable address found")
errMissingAddress = errors.New("missing address")
errCanceled = errors.New("operation was canceled")
ErrWriteToConnected = errors.New("use of WriteTo with pre-connected connection")
)
func ( error) error {
switch {
case context.Canceled:
return errCanceled
case context.DeadlineExceeded:
return errTimeout
default:
return
}
}
Err error
}
func ( *OpError) () error { return .Err }
func ( *OpError) () string {
if == nil {
return "<nil>"
}
:= .Op
if .Net != "" {
+= " " + .Net
}
if .Source != nil {
+= " " + .Source.String()
}
if .Addr != nil {
if .Source != nil {
+= "->"
} else {
+= " "
}
+= .Addr.String()
}
+= ": " + .Err.Error()
return
}
aLongTimeAgo = time.Unix(1, 0)
Text string
}
func ( *ParseError) () string { return "invalid " + .Type + ": " + .Text }
type AddrError struct {
Err string
Addr string
}
func ( *AddrError) () string {
if == nil {
return "<nil>"
}
:= .Err
if .Addr != "" {
= "address " + .Addr + ": " +
}
return
}
func ( *AddrError) () bool { return false }
func ( *AddrError) () bool { return false }
type UnknownNetworkError string
func ( UnknownNetworkError) () string { return "unknown network " + string() }
func ( UnknownNetworkError) () bool { return false }
func ( UnknownNetworkError) () bool { return false }
type InvalidAddrError string
func ( InvalidAddrError) () string { return string() }
func ( InvalidAddrError) () bool { return false }
func ( InvalidAddrError) () bool { return false }
var errTimeout error = &timeoutError{}
type timeoutError struct{}
func ( *timeoutError) () string { return "i/o timeout" }
func ( *timeoutError) () bool { return true }
func ( *timeoutError) () bool { return true }
type DNSConfigError struct {
Err error
}
func ( *DNSConfigError) () error { return .Err }
func ( *DNSConfigError) () string { return "error reading DNS config: " + .Err.Error() }
func ( *DNSConfigError) () bool { return false }
func ( *DNSConfigError) () bool { return false }
var (
errNoSuchHost = errors.New("no such host")
)
type DNSError struct {
Err string // description of the error
Name string // name looked for
Server string // server used
IsTimeout bool // if true, timed out; not all timeouts set this
IsTemporary bool // if true, error is temporary; not all errors set this
IsNotFound bool // if true, host could not be found
}
func ( *DNSError) () string {
if == nil {
return "<nil>"
}
:= "lookup " + .Name
if .Server != "" {
+= " on " + .Server
}
+= ": " + .Err
return
}
func ( *DNSError) () bool { return .IsTimeout || .IsTemporary }
var errClosed = poll.ErrNetClosing
var ErrClosed = errClosed
type writerOnly struct {
io.Writer
}
return io.Copy(writerOnly{}, )
}
var threadLimit chan struct{}
var threadOnce sync.Once
func () {
threadOnce.Do(func() {
threadLimit = make(chan struct{}, concurrentThreadsLimit())
})
threadLimit <- struct{}{}
}
func () {
<-threadLimit
}
type buffersWriter interface {
writeBuffers(*Buffers) (int64, error)
}
type Buffers [][]byte
var (
_ io.WriterTo = (*Buffers)(nil)
_ io.Reader = (*Buffers)(nil)
)
func ( *Buffers) ( io.Writer) ( int64, error) {
if , := .(buffersWriter); {
return .writeBuffers()
}
for , := range * {
, := .Write()
+= int64()
if != nil {
.consume()
return ,
}
}
.consume()
return , nil
}
func ( *Buffers) ( []byte) ( int, error) {
for len() > 0 && len(*) > 0 {
:= copy(, (*)[0])
.consume(int64())
= [:]
+=
}
if len(*) == 0 {
= io.EOF
}
return
}
func ( *Buffers) ( int64) {
for len(*) > 0 {
:= int64(len((*)[0]))
if > {
(*)[0] = (*)[0][:]
return
}
-=
* = (*)[1:]
}
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |