deps: update golang.org/x/net d28f0bde5980 -> 2180aed22343 (#4623)
Unit tests are confirmed to pass: ``` ~/go/src/golang.org/x/net$ git log --pretty=format:'%h' -n 1 2180aed ~/go/src/golang.org/x/net$ go test ./... ok golang.org/x/net/bpf 0.494s ok golang.org/x/net/context 0.058s ok golang.org/x/net/context/ctxhttp 0.104s ? golang.org/x/net/dict [no test files] ok golang.org/x/net/dns/dnsmessage 0.074s ok golang.org/x/net/html 0.097s ok golang.org/x/net/html/atom 0.002s ok golang.org/x/net/html/charset 0.020s ok golang.org/x/net/http/httpguts 0.028s ok golang.org/x/net/http/httpproxy 0.003s ok golang.org/x/net/http2 125.352s ok golang.org/x/net/http2/h2c 0.015s ? golang.org/x/net/http2/h2i [no test files] ok golang.org/x/net/http2/hpack 0.042s ok golang.org/x/net/icmp 0.002s ok golang.org/x/net/idna 0.012s ? golang.org/x/net/internal/iana [no test files] ok golang.org/x/net/internal/socket 4.560s ok golang.org/x/net/internal/socks 0.222s ok golang.org/x/net/internal/sockstest 0.015s ok golang.org/x/net/internal/timeseries 0.020s ok golang.org/x/net/ipv4 0.053s ok golang.org/x/net/ipv6 0.043s ok golang.org/x/net/nettest 1.057s ok golang.org/x/net/netutil 0.819s ok golang.org/x/net/proxy 0.039s ok golang.org/x/net/publicsuffix 0.146s ok golang.org/x/net/trace 0.007s ok golang.org/x/net/webdav 0.091s ok golang.org/x/net/webdav/internal/xml 0.010s ok golang.org/x/net/websocket 0.026s ok golang.org/x/net/xsrftoken 0.019s ```
This commit is contained in:
parent
84b2101f1d
commit
1bf07bc2ab
2
go.mod
2
go.mod
|
|
@ -32,7 +32,7 @@ require (
|
||||||
github.com/zmap/zcrypto v0.0.0-20191112190257-7f2fe6faf8cf
|
github.com/zmap/zcrypto v0.0.0-20191112190257-7f2fe6faf8cf
|
||||||
github.com/zmap/zlint v1.1.0
|
github.com/zmap/zlint v1.1.0
|
||||||
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4
|
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4
|
||||||
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980
|
golang.org/x/net v0.0.0-20191112182307-2180aed22343
|
||||||
golang.org/x/text v0.3.2
|
golang.org/x/text v0.3.2
|
||||||
google.golang.org/genproto v0.0.0-20190415143225-d1146b9035b9 // indirect
|
google.golang.org/genproto v0.0.0-20190415143225-d1146b9035b9 // indirect
|
||||||
google.golang.org/grpc v1.20.0
|
google.golang.org/grpc v1.20.0
|
||||||
|
|
|
||||||
2
go.sum
2
go.sum
|
|
@ -217,6 +217,8 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn
|
||||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980 h1:dfGZHvZk057jK2MCeWus/TowKpJ8y4AmooUzdBSR9GU=
|
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980 h1:dfGZHvZk057jK2MCeWus/TowKpJ8y4AmooUzdBSR9GU=
|
||||||
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/net v0.0.0-20191112182307-2180aed22343 h1:00ohfJ4K98s3m6BGUoBd8nyfp4Yl0GoIKvw5abItTjI=
|
||||||
|
golang.org/x/net v0.0.0-20191112182307-2180aed22343/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,7 @@ func appendIndexed(dst []byte, i uint64) []byte {
|
||||||
// extended buffer.
|
// extended buffer.
|
||||||
//
|
//
|
||||||
// If f.Sensitive is true, "Never Indexed" representation is used. If
|
// If f.Sensitive is true, "Never Indexed" representation is used. If
|
||||||
// f.Sensitive is false and indexing is true, "Inremental Indexing"
|
// f.Sensitive is false and indexing is true, "Incremental Indexing"
|
||||||
// representation is used.
|
// representation is used.
|
||||||
func appendNewName(dst []byte, f HeaderField, indexing bool) []byte {
|
func appendNewName(dst []byte, f HeaderField, indexing bool) []byte {
|
||||||
dst = append(dst, encodeTypeByte(indexing, f.Sensitive))
|
dst = append(dst, encodeTypeByte(indexing, f.Sensitive))
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ type pipe struct {
|
||||||
mu sync.Mutex
|
mu sync.Mutex
|
||||||
c sync.Cond // c.L lazily initialized to &p.mu
|
c sync.Cond // c.L lazily initialized to &p.mu
|
||||||
b pipeBuffer // nil when done reading
|
b pipeBuffer // nil when done reading
|
||||||
|
unread int // bytes unread when done
|
||||||
err error // read error once empty. non-nil means closed.
|
err error // read error once empty. non-nil means closed.
|
||||||
breakErr error // immediate read error (caller doesn't see rest of b)
|
breakErr error // immediate read error (caller doesn't see rest of b)
|
||||||
donec chan struct{} // closed on error
|
donec chan struct{} // closed on error
|
||||||
|
|
@ -33,7 +34,7 @@ func (p *pipe) Len() int {
|
||||||
p.mu.Lock()
|
p.mu.Lock()
|
||||||
defer p.mu.Unlock()
|
defer p.mu.Unlock()
|
||||||
if p.b == nil {
|
if p.b == nil {
|
||||||
return 0
|
return p.unread
|
||||||
}
|
}
|
||||||
return p.b.Len()
|
return p.b.Len()
|
||||||
}
|
}
|
||||||
|
|
@ -80,6 +81,7 @@ func (p *pipe) Write(d []byte) (n int, err error) {
|
||||||
return 0, errClosedPipeWrite
|
return 0, errClosedPipeWrite
|
||||||
}
|
}
|
||||||
if p.breakErr != nil {
|
if p.breakErr != nil {
|
||||||
|
p.unread += len(d)
|
||||||
return len(d), nil // discard when there is no reader
|
return len(d), nil // discard when there is no reader
|
||||||
}
|
}
|
||||||
return p.b.Write(d)
|
return p.b.Write(d)
|
||||||
|
|
@ -117,6 +119,9 @@ func (p *pipe) closeWithError(dst *error, err error, fn func()) {
|
||||||
}
|
}
|
||||||
p.readFn = fn
|
p.readFn = fn
|
||||||
if dst == &p.breakErr {
|
if dst == &p.breakErr {
|
||||||
|
if p.b != nil {
|
||||||
|
p.unread += p.b.Len()
|
||||||
|
}
|
||||||
p.b = nil
|
p.b = nil
|
||||||
}
|
}
|
||||||
*dst = err
|
*dst = err
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@ const (
|
||||||
firstSettingsTimeout = 2 * time.Second // should be in-flight with preface anyway
|
firstSettingsTimeout = 2 * time.Second // should be in-flight with preface anyway
|
||||||
handlerChunkWriteSize = 4 << 10
|
handlerChunkWriteSize = 4 << 10
|
||||||
defaultMaxStreams = 250 // TODO: make this 100 as the GFE seems to?
|
defaultMaxStreams = 250 // TODO: make this 100 as the GFE seems to?
|
||||||
|
maxQueuedControlFrames = 10000
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
@ -163,6 +164,15 @@ func (s *Server) maxConcurrentStreams() uint32 {
|
||||||
return defaultMaxStreams
|
return defaultMaxStreams
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// maxQueuedControlFrames is the maximum number of control frames like
|
||||||
|
// SETTINGS, PING and RST_STREAM that will be queued for writing before
|
||||||
|
// the connection is closed to prevent memory exhaustion attacks.
|
||||||
|
func (s *Server) maxQueuedControlFrames() int {
|
||||||
|
// TODO: if anybody asks, add a Server field, and remember to define the
|
||||||
|
// behavior of negative values.
|
||||||
|
return maxQueuedControlFrames
|
||||||
|
}
|
||||||
|
|
||||||
type serverInternalState struct {
|
type serverInternalState struct {
|
||||||
mu sync.Mutex
|
mu sync.Mutex
|
||||||
activeConns map[*serverConn]struct{}
|
activeConns map[*serverConn]struct{}
|
||||||
|
|
@ -242,7 +252,7 @@ func ConfigureServer(s *http.Server, conf *Server) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !haveRequired {
|
if !haveRequired {
|
||||||
return fmt.Errorf("http2: TLSConfig.CipherSuites is missing an HTTP/2-required AES_128_GCM_SHA256 cipher.")
|
return fmt.Errorf("http2: TLSConfig.CipherSuites is missing an HTTP/2-required AES_128_GCM_SHA256 cipher (need at least one of TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 or TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256).")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -312,7 +322,7 @@ type ServeConnOpts struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *ServeConnOpts) context() context.Context {
|
func (o *ServeConnOpts) context() context.Context {
|
||||||
if o.Context != nil {
|
if o != nil && o.Context != nil {
|
||||||
return o.Context
|
return o.Context
|
||||||
}
|
}
|
||||||
return context.Background()
|
return context.Background()
|
||||||
|
|
@ -506,6 +516,7 @@ type serverConn struct {
|
||||||
sawFirstSettings bool // got the initial SETTINGS frame after the preface
|
sawFirstSettings bool // got the initial SETTINGS frame after the preface
|
||||||
needToSendSettingsAck bool
|
needToSendSettingsAck bool
|
||||||
unackedSettings int // how many SETTINGS have we sent without ACKs?
|
unackedSettings int // how many SETTINGS have we sent without ACKs?
|
||||||
|
queuedControlFrames int // control frames in the writeSched queue
|
||||||
clientMaxStreams uint32 // SETTINGS_MAX_CONCURRENT_STREAMS from client (our PUSH_PROMISE limit)
|
clientMaxStreams uint32 // SETTINGS_MAX_CONCURRENT_STREAMS from client (our PUSH_PROMISE limit)
|
||||||
advMaxStreams uint32 // our SETTINGS_MAX_CONCURRENT_STREAMS advertised the client
|
advMaxStreams uint32 // our SETTINGS_MAX_CONCURRENT_STREAMS advertised the client
|
||||||
curClientStreams uint32 // number of open streams initiated by the client
|
curClientStreams uint32 // number of open streams initiated by the client
|
||||||
|
|
@ -894,6 +905,14 @@ func (sc *serverConn) serve() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the peer is causing us to generate a lot of control frames,
|
||||||
|
// but not reading them from us, assume they are trying to make us
|
||||||
|
// run out of memory.
|
||||||
|
if sc.queuedControlFrames > sc.srv.maxQueuedControlFrames() {
|
||||||
|
sc.vlogf("http2: too many control frames in send queue, closing connection")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Start the shutdown timer after sending a GOAWAY. When sending GOAWAY
|
// Start the shutdown timer after sending a GOAWAY. When sending GOAWAY
|
||||||
// with no error code (graceful shutdown), don't start the timer until
|
// with no error code (graceful shutdown), don't start the timer until
|
||||||
// all open streams have been completed.
|
// all open streams have been completed.
|
||||||
|
|
@ -1093,6 +1112,14 @@ func (sc *serverConn) writeFrame(wr FrameWriteRequest) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if !ignoreWrite {
|
if !ignoreWrite {
|
||||||
|
if wr.isControl() {
|
||||||
|
sc.queuedControlFrames++
|
||||||
|
// For extra safety, detect wraparounds, which should not happen,
|
||||||
|
// and pull the plug.
|
||||||
|
if sc.queuedControlFrames < 0 {
|
||||||
|
sc.conn.Close()
|
||||||
|
}
|
||||||
|
}
|
||||||
sc.writeSched.Push(wr)
|
sc.writeSched.Push(wr)
|
||||||
}
|
}
|
||||||
sc.scheduleFrameWrite()
|
sc.scheduleFrameWrite()
|
||||||
|
|
@ -1210,10 +1237,8 @@ func (sc *serverConn) wroteFrame(res frameWriteResult) {
|
||||||
// If a frame is already being written, nothing happens. This will be called again
|
// If a frame is already being written, nothing happens. This will be called again
|
||||||
// when the frame is done being written.
|
// when the frame is done being written.
|
||||||
//
|
//
|
||||||
// If a frame isn't being written we need to send one, the best frame
|
// If a frame isn't being written and we need to send one, the best frame
|
||||||
// to send is selected, preferring first things that aren't
|
// to send is selected by writeSched.
|
||||||
// stream-specific (e.g. ACKing settings), and then finding the
|
|
||||||
// highest priority stream.
|
|
||||||
//
|
//
|
||||||
// If a frame isn't being written and there's nothing else to send, we
|
// If a frame isn't being written and there's nothing else to send, we
|
||||||
// flush the write buffer.
|
// flush the write buffer.
|
||||||
|
|
@ -1241,6 +1266,9 @@ func (sc *serverConn) scheduleFrameWrite() {
|
||||||
}
|
}
|
||||||
if !sc.inGoAway || sc.goAwayCode == ErrCodeNo {
|
if !sc.inGoAway || sc.goAwayCode == ErrCodeNo {
|
||||||
if wr, ok := sc.writeSched.Pop(); ok {
|
if wr, ok := sc.writeSched.Pop(); ok {
|
||||||
|
if wr.isControl() {
|
||||||
|
sc.queuedControlFrames--
|
||||||
|
}
|
||||||
sc.startFrameWrite(wr)
|
sc.startFrameWrite(wr)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
@ -1533,6 +1561,8 @@ func (sc *serverConn) processSettings(f *SettingsFrame) error {
|
||||||
if err := f.ForeachSetting(sc.processSetting); err != nil {
|
if err := f.ForeachSetting(sc.processSetting); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
// TODO: judging by RFC 7540, Section 6.5.3 each SETTINGS frame should be
|
||||||
|
// acknowledged individually, even if multiple are received before the ACK.
|
||||||
sc.needToSendSettingsAck = true
|
sc.needToSendSettingsAck = true
|
||||||
sc.scheduleFrameWrite()
|
sc.scheduleFrameWrite()
|
||||||
return nil
|
return nil
|
||||||
|
|
@ -2385,7 +2415,11 @@ func (rws *responseWriterState) writeChunk(p []byte) (n int, err error) {
|
||||||
clen = strconv.Itoa(len(p))
|
clen = strconv.Itoa(len(p))
|
||||||
}
|
}
|
||||||
_, hasContentType := rws.snapHeader["Content-Type"]
|
_, hasContentType := rws.snapHeader["Content-Type"]
|
||||||
if !hasContentType && bodyAllowedForStatus(rws.status) && len(p) > 0 {
|
// If the Content-Encoding is non-blank, we shouldn't
|
||||||
|
// sniff the body. See Issue golang.org/issue/31753.
|
||||||
|
ce := rws.snapHeader.Get("Content-Encoding")
|
||||||
|
hasCE := len(ce) > 0
|
||||||
|
if !hasCE && !hasContentType && bodyAllowedForStatus(rws.status) && len(p) > 0 {
|
||||||
ctype = http.DetectContentType(p)
|
ctype = http.DetectContentType(p)
|
||||||
}
|
}
|
||||||
var date string
|
var date string
|
||||||
|
|
@ -2494,7 +2528,7 @@ const TrailerPrefix = "Trailer:"
|
||||||
// trailers. That worked for a while, until we found the first major
|
// trailers. That worked for a while, until we found the first major
|
||||||
// user of Trailers in the wild: gRPC (using them only over http2),
|
// user of Trailers in the wild: gRPC (using them only over http2),
|
||||||
// and gRPC libraries permit setting trailers mid-stream without
|
// and gRPC libraries permit setting trailers mid-stream without
|
||||||
// predeclarnig them. So: change of plans. We still permit the old
|
// predeclaring them. So: change of plans. We still permit the old
|
||||||
// way, but we also permit this hack: if a Header() key begins with
|
// way, but we also permit this hack: if a Header() key begins with
|
||||||
// "Trailer:", the suffix of that key is a Trailer. Because ':' is an
|
// "Trailer:", the suffix of that key is a Trailer. Because ':' is an
|
||||||
// invalid token byte anyway, there is no ambiguity. (And it's already
|
// invalid token byte anyway, there is no ambiguity. (And it's already
|
||||||
|
|
@ -2794,7 +2828,7 @@ func (sc *serverConn) startPush(msg *startPushRequest) {
|
||||||
// PUSH_PROMISE frames MUST only be sent on a peer-initiated stream that
|
// PUSH_PROMISE frames MUST only be sent on a peer-initiated stream that
|
||||||
// is in either the "open" or "half-closed (remote)" state.
|
// is in either the "open" or "half-closed (remote)" state.
|
||||||
if msg.parent.state != stateOpen && msg.parent.state != stateHalfClosedRemote {
|
if msg.parent.state != stateOpen && msg.parent.state != stateHalfClosedRemote {
|
||||||
// responseWriter.Push checks that the stream is peer-initiaed.
|
// responseWriter.Push checks that the stream is peer-initiated.
|
||||||
msg.done <- errStreamClosed
|
msg.done <- errStreamClosed
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -603,7 +603,7 @@ func (t *Transport) expectContinueTimeout() time.Duration {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Transport) NewClientConn(c net.Conn) (*ClientConn, error) {
|
func (t *Transport) NewClientConn(c net.Conn) (*ClientConn, error) {
|
||||||
return t.newClientConn(c, false)
|
return t.newClientConn(c, t.disableKeepAlives())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Transport) newClientConn(c net.Conn, singleUse bool) (*ClientConn, error) {
|
func (t *Transport) newClientConn(c net.Conn, singleUse bool) (*ClientConn, error) {
|
||||||
|
|
@ -992,7 +992,7 @@ func (cc *ClientConn) roundTrip(req *http.Request) (res *http.Response, gotErrAf
|
||||||
req.Method != "HEAD" {
|
req.Method != "HEAD" {
|
||||||
// Request gzip only, not deflate. Deflate is ambiguous and
|
// Request gzip only, not deflate. Deflate is ambiguous and
|
||||||
// not as universally supported anyway.
|
// not as universally supported anyway.
|
||||||
// See: http://www.gzip.org/zlib/zlib_faq.html#faq38
|
// See: https://zlib.net/zlib_faq.html#faq39
|
||||||
//
|
//
|
||||||
// Note that we don't request this for HEAD requests,
|
// Note that we don't request this for HEAD requests,
|
||||||
// due to a bug in nginx:
|
// due to a bug in nginx:
|
||||||
|
|
@ -1216,6 +1216,8 @@ var (
|
||||||
|
|
||||||
// abort request body write, but send stream reset of cancel.
|
// abort request body write, but send stream reset of cancel.
|
||||||
errStopReqBodyWriteAndCancel = errors.New("http2: canceling request")
|
errStopReqBodyWriteAndCancel = errors.New("http2: canceling request")
|
||||||
|
|
||||||
|
errReqBodyTooLong = errors.New("http2: request body larger than specified content length")
|
||||||
)
|
)
|
||||||
|
|
||||||
func (cs *clientStream) writeRequestBody(body io.Reader, bodyCloser io.Closer) (err error) {
|
func (cs *clientStream) writeRequestBody(body io.Reader, bodyCloser io.Closer) (err error) {
|
||||||
|
|
@ -1238,10 +1240,32 @@ func (cs *clientStream) writeRequestBody(body io.Reader, bodyCloser io.Closer) (
|
||||||
|
|
||||||
req := cs.req
|
req := cs.req
|
||||||
hasTrailers := req.Trailer != nil
|
hasTrailers := req.Trailer != nil
|
||||||
|
remainLen := actualContentLength(req)
|
||||||
|
hasContentLen := remainLen != -1
|
||||||
|
|
||||||
var sawEOF bool
|
var sawEOF bool
|
||||||
for !sawEOF {
|
for !sawEOF {
|
||||||
n, err := body.Read(buf)
|
n, err := body.Read(buf[:len(buf)-1])
|
||||||
|
if hasContentLen {
|
||||||
|
remainLen -= int64(n)
|
||||||
|
if remainLen == 0 && err == nil {
|
||||||
|
// The request body's Content-Length was predeclared and
|
||||||
|
// we just finished reading it all, but the underlying io.Reader
|
||||||
|
// returned the final chunk with a nil error (which is one of
|
||||||
|
// the two valid things a Reader can do at EOF). Because we'd prefer
|
||||||
|
// to send the END_STREAM bit early, double-check that we're actually
|
||||||
|
// at EOF. Subsequent reads should return (0, EOF) at this point.
|
||||||
|
// If either value is different, we return an error in one of two ways below.
|
||||||
|
var n1 int
|
||||||
|
n1, err = body.Read(buf[n:])
|
||||||
|
remainLen -= int64(n1)
|
||||||
|
}
|
||||||
|
if remainLen < 0 {
|
||||||
|
err = errReqBodyTooLong
|
||||||
|
cc.writeStreamReset(cs.ID, ErrCodeCancel, err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
if err == io.EOF {
|
if err == io.EOF {
|
||||||
sawEOF = true
|
sawEOF = true
|
||||||
err = nil
|
err = nil
|
||||||
|
|
@ -1454,7 +1478,29 @@ func (cc *ClientConn) encodeHeaders(req *http.Request, addGzipHeader bool, trail
|
||||||
if vv[0] == "" {
|
if vv[0] == "" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
} else if strings.EqualFold(k, "cookie") {
|
||||||
|
// Per 8.1.2.5 To allow for better compression efficiency, the
|
||||||
|
// Cookie header field MAY be split into separate header fields,
|
||||||
|
// each with one or more cookie-pairs.
|
||||||
|
for _, v := range vv {
|
||||||
|
for {
|
||||||
|
p := strings.IndexByte(v, ';')
|
||||||
|
if p < 0 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
f("cookie", v[:p])
|
||||||
|
p++
|
||||||
|
// strip space after semicolon if any.
|
||||||
|
for p+1 <= len(v) && v[p] == ' ' {
|
||||||
|
p++
|
||||||
|
}
|
||||||
|
v = v[p:]
|
||||||
|
}
|
||||||
|
if len(v) > 0 {
|
||||||
|
f("cookie", v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, v := range vv {
|
for _, v := range vv {
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ type WriteScheduler interface {
|
||||||
|
|
||||||
// Pop dequeues the next frame to write. Returns false if no frames can
|
// Pop dequeues the next frame to write. Returns false if no frames can
|
||||||
// be written. Frames with a given wr.StreamID() are Pop'd in the same
|
// be written. Frames with a given wr.StreamID() are Pop'd in the same
|
||||||
// order they are Push'd.
|
// order they are Push'd. No frames should be discarded except by CloseStream.
|
||||||
Pop() (wr FrameWriteRequest, ok bool)
|
Pop() (wr FrameWriteRequest, ok bool)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -76,6 +76,12 @@ func (wr FrameWriteRequest) StreamID() uint32 {
|
||||||
return wr.stream.id
|
return wr.stream.id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// isControl reports whether wr is a control frame for MaxQueuedControlFrames
|
||||||
|
// purposes. That includes non-stream frames and RST_STREAM frames.
|
||||||
|
func (wr FrameWriteRequest) isControl() bool {
|
||||||
|
return wr.stream == nil
|
||||||
|
}
|
||||||
|
|
||||||
// DataSize returns the number of flow control bytes that must be consumed
|
// DataSize returns the number of flow control bytes that must be consumed
|
||||||
// to write this entire frame. This is 0 for non-DATA frames.
|
// to write this entire frame. This is 0 for non-DATA frames.
|
||||||
func (wr FrameWriteRequest) DataSize() int {
|
func (wr FrameWriteRequest) DataSize() int {
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,7 @@ func (n *priorityNode) addBytes(b int64) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// walkReadyInOrder iterates over the tree in priority order, calling f for each node
|
// walkReadyInOrder iterates over the tree in priority order, calling f for each node
|
||||||
// with a non-empty write queue. When f returns true, this funcion returns true and the
|
// with a non-empty write queue. When f returns true, this function returns true and the
|
||||||
// walk halts. tmp is used as scratch space for sorting.
|
// walk halts. tmp is used as scratch space for sorting.
|
||||||
//
|
//
|
||||||
// f(n, openParent) takes two arguments: the node to visit, n, and a bool that is true
|
// f(n, openParent) takes two arguments: the node to visit, n, and a bool that is true
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,8 @@ type randomWriteScheduler struct {
|
||||||
zero writeQueue
|
zero writeQueue
|
||||||
|
|
||||||
// sq contains the stream-specific queues, keyed by stream ID.
|
// sq contains the stream-specific queues, keyed by stream ID.
|
||||||
// When a stream is idle or closed, it's deleted from the map.
|
// When a stream is idle, closed, or emptied, it's deleted
|
||||||
|
// from the map.
|
||||||
sq map[uint32]*writeQueue
|
sq map[uint32]*writeQueue
|
||||||
|
|
||||||
// pool of empty queues for reuse.
|
// pool of empty queues for reuse.
|
||||||
|
|
@ -63,8 +64,12 @@ func (ws *randomWriteScheduler) Pop() (FrameWriteRequest, bool) {
|
||||||
return ws.zero.shift(), true
|
return ws.zero.shift(), true
|
||||||
}
|
}
|
||||||
// Iterate over all non-idle streams until finding one that can be consumed.
|
// Iterate over all non-idle streams until finding one that can be consumed.
|
||||||
for _, q := range ws.sq {
|
for streamID, q := range ws.sq {
|
||||||
if wr, ok := q.consume(math.MaxInt32); ok {
|
if wr, ok := q.consume(math.MaxInt32); ok {
|
||||||
|
if q.empty() {
|
||||||
|
delete(ws.sq, streamID)
|
||||||
|
ws.queuePool.put(q)
|
||||||
|
}
|
||||||
return wr, true
|
return wr, true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
||||||
|
|
||||||
// +build go1.13
|
// +build go1.13,!go1.14
|
||||||
|
|
||||||
package idna
|
package idna
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,12 @@
|
||||||
|
// Copyright 2019 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build !race
|
||||||
|
|
||||||
|
package socket
|
||||||
|
|
||||||
|
func (m *Message) raceRead() {
|
||||||
|
}
|
||||||
|
func (m *Message) raceWrite() {
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
// Copyright 2019 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build race
|
||||||
|
|
||||||
|
package socket
|
||||||
|
|
||||||
|
import (
|
||||||
|
"runtime"
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
|
// This package reads and writes the Message buffers using a
|
||||||
|
// direct system call, which the race detector can't see.
|
||||||
|
// These functions tell the race detector what is going on during the syscall.
|
||||||
|
|
||||||
|
func (m *Message) raceRead() {
|
||||||
|
for _, b := range m.Buffers {
|
||||||
|
if len(b) > 0 {
|
||||||
|
runtime.RaceReadRange(unsafe.Pointer(&b[0]), len(b))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if b := m.OOB; len(b) > 0 {
|
||||||
|
runtime.RaceReadRange(unsafe.Pointer(&b[0]), len(b))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (m *Message) raceWrite() {
|
||||||
|
for _, b := range m.Buffers {
|
||||||
|
if len(b) > 0 {
|
||||||
|
runtime.RaceWriteRange(unsafe.Pointer(&b[0]), len(b))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if b := m.OOB; len(b) > 0 {
|
||||||
|
runtime.RaceWriteRange(unsafe.Pointer(&b[0]), len(b))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -13,6 +13,9 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func (c *Conn) recvMsgs(ms []Message, flags int) (int, error) {
|
func (c *Conn) recvMsgs(ms []Message, flags int) (int, error) {
|
||||||
|
for i := range ms {
|
||||||
|
ms[i].raceWrite()
|
||||||
|
}
|
||||||
hs := make(mmsghdrs, len(ms))
|
hs := make(mmsghdrs, len(ms))
|
||||||
var parseFn func([]byte, string) (net.Addr, error)
|
var parseFn func([]byte, string) (net.Addr, error)
|
||||||
if c.network != "tcp" {
|
if c.network != "tcp" {
|
||||||
|
|
@ -43,6 +46,9 @@ func (c *Conn) recvMsgs(ms []Message, flags int) (int, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Conn) sendMsgs(ms []Message, flags int) (int, error) {
|
func (c *Conn) sendMsgs(ms []Message, flags int) (int, error) {
|
||||||
|
for i := range ms {
|
||||||
|
ms[i].raceRead()
|
||||||
|
}
|
||||||
hs := make(mmsghdrs, len(ms))
|
hs := make(mmsghdrs, len(ms))
|
||||||
var marshalFn func(net.Addr) []byte
|
var marshalFn func(net.Addr) []byte
|
||||||
if c.network != "tcp" {
|
if c.network != "tcp" {
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func (c *Conn) recvMsg(m *Message, flags int) error {
|
func (c *Conn) recvMsg(m *Message, flags int) error {
|
||||||
|
m.raceWrite()
|
||||||
var h msghdr
|
var h msghdr
|
||||||
vs := make([]iovec, len(m.Buffers))
|
vs := make([]iovec, len(m.Buffers))
|
||||||
var sa []byte
|
var sa []byte
|
||||||
|
|
@ -48,6 +49,7 @@ func (c *Conn) recvMsg(m *Message, flags int) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Conn) sendMsg(m *Message, flags int) error {
|
func (c *Conn) sendMsg(m *Message, flags int) error {
|
||||||
|
m.raceRead()
|
||||||
var h msghdr
|
var h msghdr
|
||||||
vs := make([]iovec, len(m.Buffers))
|
vs := make([]iovec, len(m.Buffers))
|
||||||
var sa []byte
|
var sa []byte
|
||||||
|
|
|
||||||
|
|
@ -4,4 +4,29 @@
|
||||||
|
|
||||||
package socket
|
package socket
|
||||||
|
|
||||||
func probeProtocolStack() int { return 4 }
|
import (
|
||||||
|
"sync"
|
||||||
|
"syscall"
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
|
// See version list in https://github.com/DragonFlyBSD/DragonFlyBSD/blob/master/sys/sys/param.h
|
||||||
|
var (
|
||||||
|
osreldateOnce sync.Once
|
||||||
|
osreldate uint32
|
||||||
|
)
|
||||||
|
|
||||||
|
// First __DragonFly_version after September 2019 ABI changes
|
||||||
|
// http://lists.dragonflybsd.org/pipermail/users/2019-September/358280.html
|
||||||
|
const _dragonflyABIChangeVersion = 500705
|
||||||
|
|
||||||
|
func probeProtocolStack() int {
|
||||||
|
osreldateOnce.Do(func() { osreldate, _ = syscall.SysctlUint32("kern.osreldate") })
|
||||||
|
var p uintptr
|
||||||
|
if int(unsafe.Sizeof(p)) == 8 && osreldate >= _dragonflyABIChangeVersion {
|
||||||
|
return int(unsafe.Sizeof(p))
|
||||||
|
}
|
||||||
|
// 64-bit Dragonfly before the September 2019 ABI changes still requires
|
||||||
|
// 32-bit aligned access to network subsystem.
|
||||||
|
return 4
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ func marshalSockaddr(ip net.IP, port int, zone string) []byte {
|
||||||
if ip4 := ip.To4(); ip4 != nil {
|
if ip4 := ip.To4(); ip4 != nil {
|
||||||
b := make([]byte, sizeofSockaddrInet)
|
b := make([]byte, sizeofSockaddrInet)
|
||||||
switch runtime.GOOS {
|
switch runtime.GOOS {
|
||||||
case "android", "linux", "solaris", "windows":
|
case "android", "illumos", "linux", "solaris", "windows":
|
||||||
NativeEndian.PutUint16(b[:2], uint16(sysAF_INET))
|
NativeEndian.PutUint16(b[:2], uint16(sysAF_INET))
|
||||||
default:
|
default:
|
||||||
b[0] = sizeofSockaddrInet
|
b[0] = sizeofSockaddrInet
|
||||||
|
|
@ -46,7 +46,7 @@ func marshalSockaddr(ip net.IP, port int, zone string) []byte {
|
||||||
if ip6 := ip.To16(); ip6 != nil && ip.To4() == nil {
|
if ip6 := ip.To16(); ip6 != nil && ip.To4() == nil {
|
||||||
b := make([]byte, sizeofSockaddrInet6)
|
b := make([]byte, sizeofSockaddrInet6)
|
||||||
switch runtime.GOOS {
|
switch runtime.GOOS {
|
||||||
case "android", "linux", "solaris", "windows":
|
case "android", "illumos", "linux", "solaris", "windows":
|
||||||
NativeEndian.PutUint16(b[:2], uint16(sysAF_INET6))
|
NativeEndian.PutUint16(b[:2], uint16(sysAF_INET6))
|
||||||
default:
|
default:
|
||||||
b[0] = sizeofSockaddrInet6
|
b[0] = sizeofSockaddrInet6
|
||||||
|
|
@ -68,7 +68,7 @@ func parseInetAddr(b []byte, network string) (net.Addr, error) {
|
||||||
}
|
}
|
||||||
var af int
|
var af int
|
||||||
switch runtime.GOOS {
|
switch runtime.GOOS {
|
||||||
case "android", "linux", "solaris", "windows":
|
case "android", "illumos", "linux", "solaris", "windows":
|
||||||
af = int(NativeEndian.Uint16(b[:2]))
|
af = int(NativeEndian.Uint16(b[:2]))
|
||||||
default:
|
default:
|
||||||
af = int(b[1])
|
af = int(b[1])
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,6 @@ type sockaddrInet6 struct {
|
||||||
const (
|
const (
|
||||||
sizeofIovec = 0x10
|
sizeofIovec = 0x10
|
||||||
sizeofMsghdr = 0x30
|
sizeofMsghdr = 0x30
|
||||||
sizeofMmsghdr = 0x38
|
|
||||||
sizeofCmsghdr = 0xc
|
sizeofCmsghdr = 0xc
|
||||||
|
|
||||||
sizeofSockaddrInet = 0x10
|
sizeofSockaddrInet = 0x10
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,6 @@ type sockaddrInet6 struct {
|
||||||
const (
|
const (
|
||||||
sizeofIovec = 0x8
|
sizeofIovec = 0x8
|
||||||
sizeofMsghdr = 0x1c
|
sizeofMsghdr = 0x1c
|
||||||
sizeofMmsghdr = 0x20
|
|
||||||
sizeofCmsghdr = 0xc
|
sizeofCmsghdr = 0xc
|
||||||
|
|
||||||
sizeofSockaddrInet = 0x10
|
sizeofSockaddrInet = 0x10
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,6 @@ type sockaddrInet6 struct {
|
||||||
const (
|
const (
|
||||||
sizeofIovec = 0x10
|
sizeofIovec = 0x10
|
||||||
sizeofMsghdr = 0x38
|
sizeofMsghdr = 0x38
|
||||||
sizeofMmsghdr = 0x40
|
|
||||||
sizeofCmsghdr = 0x10
|
sizeofCmsghdr = 0x10
|
||||||
|
|
||||||
sizeofSockaddrInet = 0x10
|
sizeofSockaddrInet = 0x10
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ type sockaddrInet6 struct {
|
||||||
const (
|
const (
|
||||||
sizeofIovec = 0x8
|
sizeofIovec = 0x8
|
||||||
sizeofMsghdr = 0x1c
|
sizeofMsghdr = 0x1c
|
||||||
sizeofMmsghdr = 0x20
|
|
||||||
sizeofCmsghdr = 0xc
|
sizeofCmsghdr = 0xc
|
||||||
|
|
||||||
sizeofSockaddrInet = 0x10
|
sizeofSockaddrInet = 0x10
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ type sockaddrInet6 struct {
|
||||||
const (
|
const (
|
||||||
sizeofIovec = 0x10
|
sizeofIovec = 0x10
|
||||||
sizeofMsghdr = 0x38
|
sizeofMsghdr = 0x38
|
||||||
sizeofMmsghdr = 0x40
|
|
||||||
sizeofCmsghdr = 0x10
|
sizeofCmsghdr = 0x10
|
||||||
|
|
||||||
sizeofSockaddrInet = 0x10
|
sizeofSockaddrInet = 0x10
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ type sockaddrInet6 struct {
|
||||||
const (
|
const (
|
||||||
sizeofIovec = 0x8
|
sizeofIovec = 0x8
|
||||||
sizeofMsghdr = 0x1c
|
sizeofMsghdr = 0x1c
|
||||||
sizeofMmsghdr = 0x20
|
|
||||||
sizeofCmsghdr = 0xc
|
sizeofCmsghdr = 0xc
|
||||||
|
|
||||||
sizeofSockaddrInet = 0x10
|
sizeofSockaddrInet = 0x10
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ type sockaddrInet6 struct {
|
||||||
const (
|
const (
|
||||||
sizeofIovec = 0x10
|
sizeofIovec = 0x10
|
||||||
sizeofMsghdr = 0x38
|
sizeofMsghdr = 0x38
|
||||||
sizeofMmsghdr = 0x40
|
|
||||||
sizeofCmsghdr = 0x10
|
sizeofCmsghdr = 0x10
|
||||||
|
|
||||||
sizeofSockaddrInet = 0x10
|
sizeofSockaddrInet = 0x10
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ type sockaddrInet6 struct {
|
||||||
const (
|
const (
|
||||||
sizeofIovec = 0x10
|
sizeofIovec = 0x10
|
||||||
sizeofMsghdr = 0x38
|
sizeofMsghdr = 0x38
|
||||||
sizeofMmsghdr = 0x40
|
|
||||||
sizeofCmsghdr = 0x10
|
sizeofCmsghdr = 0x10
|
||||||
|
|
||||||
sizeofSockaddrInet = 0x10
|
sizeofSockaddrInet = 0x10
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ type sockaddrInet6 struct {
|
||||||
const (
|
const (
|
||||||
sizeofIovec = 0x8
|
sizeofIovec = 0x8
|
||||||
sizeofMsghdr = 0x1c
|
sizeofMsghdr = 0x1c
|
||||||
sizeofMmsghdr = 0x20
|
|
||||||
sizeofCmsghdr = 0xc
|
sizeofCmsghdr = 0xc
|
||||||
|
|
||||||
sizeofSockaddrInet = 0x10
|
sizeofSockaddrInet = 0x10
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ type sockaddrInet6 struct {
|
||||||
const (
|
const (
|
||||||
sizeofIovec = 0x10
|
sizeofIovec = 0x10
|
||||||
sizeofMsghdr = 0x38
|
sizeofMsghdr = 0x38
|
||||||
sizeofMmsghdr = 0x40
|
|
||||||
sizeofCmsghdr = 0x10
|
sizeofCmsghdr = 0x10
|
||||||
|
|
||||||
sizeofSockaddrInet = 0x10
|
sizeofSockaddrInet = 0x10
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ type sockaddrInet6 struct {
|
||||||
const (
|
const (
|
||||||
sizeofIovec = 0x10
|
sizeofIovec = 0x10
|
||||||
sizeofMsghdr = 0x38
|
sizeofMsghdr = 0x38
|
||||||
sizeofMmsghdr = 0x40
|
|
||||||
sizeofCmsghdr = 0x10
|
sizeofCmsghdr = 0x10
|
||||||
|
|
||||||
sizeofSockaddrInet = 0x10
|
sizeofSockaddrInet = 0x10
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ type sockaddrInet6 struct {
|
||||||
const (
|
const (
|
||||||
sizeofIovec = 0x10
|
sizeofIovec = 0x10
|
||||||
sizeofMsghdr = 0x38
|
sizeofMsghdr = 0x38
|
||||||
sizeofMmsghdr = 0x40
|
|
||||||
sizeofCmsghdr = 0x10
|
sizeofCmsghdr = 0x10
|
||||||
|
|
||||||
sizeofSockaddrInet = 0x10
|
sizeofSockaddrInet = 0x10
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ type sockaddrInet6 struct {
|
||||||
const (
|
const (
|
||||||
sizeofIovec = 0x10
|
sizeofIovec = 0x10
|
||||||
sizeofMsghdr = 0x38
|
sizeofMsghdr = 0x38
|
||||||
sizeofMmsghdr = 0x40
|
|
||||||
sizeofCmsghdr = 0x10
|
sizeofCmsghdr = 0x10
|
||||||
|
|
||||||
sizeofSockaddrInet = 0x10
|
sizeofSockaddrInet = 0x10
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ type sockaddrInet6 struct {
|
||||||
const (
|
const (
|
||||||
sizeofIovec = 0x8
|
sizeofIovec = 0x8
|
||||||
sizeofMsghdr = 0x1c
|
sizeofMsghdr = 0x1c
|
||||||
sizeofMmsghdr = 0x20
|
|
||||||
sizeofCmsghdr = 0xc
|
sizeofCmsghdr = 0xc
|
||||||
|
|
||||||
sizeofSockaddrInet = 0x10
|
sizeofSockaddrInet = 0x10
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ type sockaddrInet6 struct {
|
||||||
const (
|
const (
|
||||||
sizeofIovec = 0x10
|
sizeofIovec = 0x10
|
||||||
sizeofMsghdr = 0x30
|
sizeofMsghdr = 0x30
|
||||||
sizeofMmsghdr = 0x40
|
|
||||||
sizeofCmsghdr = 0xc
|
sizeofCmsghdr = 0xc
|
||||||
|
|
||||||
sizeofSockaddrInet = 0x10
|
sizeofSockaddrInet = 0x10
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ type sockaddrInet6 struct {
|
||||||
const (
|
const (
|
||||||
sizeofIovec = 0x8
|
sizeofIovec = 0x8
|
||||||
sizeofMsghdr = 0x1c
|
sizeofMsghdr = 0x1c
|
||||||
sizeofMmsghdr = 0x20
|
|
||||||
sizeofCmsghdr = 0xc
|
sizeofCmsghdr = 0xc
|
||||||
|
|
||||||
sizeofSockaddrInet = 0x10
|
sizeofSockaddrInet = 0x10
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,6 @@ type sockaddrInet6 struct {
|
||||||
const (
|
const (
|
||||||
sizeofIovec = 0x10
|
sizeofIovec = 0x10
|
||||||
sizeofMsghdr = 0x30
|
sizeofMsghdr = 0x30
|
||||||
sizeofMmsghdr = 0x40
|
|
||||||
sizeofCmsghdr = 0xc
|
sizeofCmsghdr = 0xc
|
||||||
|
|
||||||
sizeofSockaddrInet = 0x10
|
sizeofSockaddrInet = 0x10
|
||||||
|
|
|
||||||
|
|
@ -403,9 +403,9 @@ func (ts *timeSeries) extract(l *tsLevel, start, finish time.Time, num int, resu
|
||||||
|
|
||||||
// Where should scanning start?
|
// Where should scanning start?
|
||||||
if dstStart.After(srcStart) {
|
if dstStart.After(srcStart) {
|
||||||
advance := dstStart.Sub(srcStart) / srcInterval
|
advance := int(dstStart.Sub(srcStart) / srcInterval)
|
||||||
srcIndex += int(advance)
|
srcIndex += advance
|
||||||
srcStart = srcStart.Add(advance * srcInterval)
|
srcStart = srcStart.Add(time.Duration(advance) * srcInterval)
|
||||||
}
|
}
|
||||||
|
|
||||||
// The i'th value is computed as show below.
|
// The i'th value is computed as show below.
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ func marshalInterface(b []byte, cm *ControlMessage) []byte {
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseInterface(cm *ControlMessage, b []byte) {
|
func parseInterface(cm *ControlMessage, b []byte) {
|
||||||
sadl := (*syscall.SockaddrDatalink)(unsafe.Pointer(&b[0]))
|
var sadl syscall.SockaddrDatalink
|
||||||
|
copy((*[unsafe.Sizeof(sadl)]byte)(unsafe.Pointer(&sadl))[:], b)
|
||||||
cm.IfIndex = int(sadl.Index)
|
cm.IfIndex = int(sadl.Index)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,93 @@
|
||||||
|
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||||
|
// cgo -godefs defs_freebsd.go
|
||||||
|
|
||||||
|
package ipv4
|
||||||
|
|
||||||
|
const (
|
||||||
|
sysIP_OPTIONS = 0x1
|
||||||
|
sysIP_HDRINCL = 0x2
|
||||||
|
sysIP_TOS = 0x3
|
||||||
|
sysIP_TTL = 0x4
|
||||||
|
sysIP_RECVOPTS = 0x5
|
||||||
|
sysIP_RECVRETOPTS = 0x6
|
||||||
|
sysIP_RECVDSTADDR = 0x7
|
||||||
|
sysIP_SENDSRCADDR = 0x7
|
||||||
|
sysIP_RETOPTS = 0x8
|
||||||
|
sysIP_RECVIF = 0x14
|
||||||
|
sysIP_ONESBCAST = 0x17
|
||||||
|
sysIP_BINDANY = 0x18
|
||||||
|
sysIP_RECVTTL = 0x41
|
||||||
|
sysIP_MINTTL = 0x42
|
||||||
|
sysIP_DONTFRAG = 0x43
|
||||||
|
sysIP_RECVTOS = 0x44
|
||||||
|
|
||||||
|
sysIP_MULTICAST_IF = 0x9
|
||||||
|
sysIP_MULTICAST_TTL = 0xa
|
||||||
|
sysIP_MULTICAST_LOOP = 0xb
|
||||||
|
sysIP_ADD_MEMBERSHIP = 0xc
|
||||||
|
sysIP_DROP_MEMBERSHIP = 0xd
|
||||||
|
sysIP_MULTICAST_VIF = 0xe
|
||||||
|
sysIP_ADD_SOURCE_MEMBERSHIP = 0x46
|
||||||
|
sysIP_DROP_SOURCE_MEMBERSHIP = 0x47
|
||||||
|
sysIP_BLOCK_SOURCE = 0x48
|
||||||
|
sysIP_UNBLOCK_SOURCE = 0x49
|
||||||
|
sysMCAST_JOIN_GROUP = 0x50
|
||||||
|
sysMCAST_LEAVE_GROUP = 0x51
|
||||||
|
sysMCAST_JOIN_SOURCE_GROUP = 0x52
|
||||||
|
sysMCAST_LEAVE_SOURCE_GROUP = 0x53
|
||||||
|
sysMCAST_BLOCK_SOURCE = 0x54
|
||||||
|
sysMCAST_UNBLOCK_SOURCE = 0x55
|
||||||
|
|
||||||
|
sizeofSockaddrStorage = 0x80
|
||||||
|
sizeofSockaddrInet = 0x10
|
||||||
|
|
||||||
|
sizeofIPMreq = 0x8
|
||||||
|
sizeofIPMreqn = 0xc
|
||||||
|
sizeofIPMreqSource = 0xc
|
||||||
|
sizeofGroupReq = 0x88
|
||||||
|
sizeofGroupSourceReq = 0x108
|
||||||
|
)
|
||||||
|
|
||||||
|
type sockaddrStorage struct {
|
||||||
|
Len uint8
|
||||||
|
Family uint8
|
||||||
|
X__ss_pad1 [6]uint8
|
||||||
|
X__ss_align int64
|
||||||
|
X__ss_pad2 [112]uint8
|
||||||
|
}
|
||||||
|
|
||||||
|
type sockaddrInet struct {
|
||||||
|
Len uint8
|
||||||
|
Family uint8
|
||||||
|
Port uint16
|
||||||
|
Addr [4]byte /* in_addr */
|
||||||
|
Zero [8]uint8
|
||||||
|
}
|
||||||
|
|
||||||
|
type ipMreq struct {
|
||||||
|
Multiaddr [4]byte /* in_addr */
|
||||||
|
Interface [4]byte /* in_addr */
|
||||||
|
}
|
||||||
|
|
||||||
|
type ipMreqn struct {
|
||||||
|
Multiaddr [4]byte /* in_addr */
|
||||||
|
Address [4]byte /* in_addr */
|
||||||
|
Ifindex int32
|
||||||
|
}
|
||||||
|
|
||||||
|
type ipMreqSource struct {
|
||||||
|
Multiaddr [4]byte /* in_addr */
|
||||||
|
Sourceaddr [4]byte /* in_addr */
|
||||||
|
Interface [4]byte /* in_addr */
|
||||||
|
}
|
||||||
|
|
||||||
|
type groupReq struct {
|
||||||
|
Interface uint32
|
||||||
|
Group sockaddrStorage
|
||||||
|
}
|
||||||
|
|
||||||
|
type groupSourceReq struct {
|
||||||
|
Interface uint32
|
||||||
|
Group sockaddrStorage
|
||||||
|
Source sockaddrStorage
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,122 @@
|
||||||
|
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||||
|
// cgo -godefs defs_freebsd.go
|
||||||
|
|
||||||
|
package ipv6
|
||||||
|
|
||||||
|
const (
|
||||||
|
sysIPV6_UNICAST_HOPS = 0x4
|
||||||
|
sysIPV6_MULTICAST_IF = 0x9
|
||||||
|
sysIPV6_MULTICAST_HOPS = 0xa
|
||||||
|
sysIPV6_MULTICAST_LOOP = 0xb
|
||||||
|
sysIPV6_JOIN_GROUP = 0xc
|
||||||
|
sysIPV6_LEAVE_GROUP = 0xd
|
||||||
|
sysIPV6_PORTRANGE = 0xe
|
||||||
|
sysICMP6_FILTER = 0x12
|
||||||
|
|
||||||
|
sysIPV6_CHECKSUM = 0x1a
|
||||||
|
sysIPV6_V6ONLY = 0x1b
|
||||||
|
|
||||||
|
sysIPV6_IPSEC_POLICY = 0x1c
|
||||||
|
|
||||||
|
sysIPV6_RTHDRDSTOPTS = 0x23
|
||||||
|
|
||||||
|
sysIPV6_RECVPKTINFO = 0x24
|
||||||
|
sysIPV6_RECVHOPLIMIT = 0x25
|
||||||
|
sysIPV6_RECVRTHDR = 0x26
|
||||||
|
sysIPV6_RECVHOPOPTS = 0x27
|
||||||
|
sysIPV6_RECVDSTOPTS = 0x28
|
||||||
|
|
||||||
|
sysIPV6_USE_MIN_MTU = 0x2a
|
||||||
|
sysIPV6_RECVPATHMTU = 0x2b
|
||||||
|
|
||||||
|
sysIPV6_PATHMTU = 0x2c
|
||||||
|
|
||||||
|
sysIPV6_PKTINFO = 0x2e
|
||||||
|
sysIPV6_HOPLIMIT = 0x2f
|
||||||
|
sysIPV6_NEXTHOP = 0x30
|
||||||
|
sysIPV6_HOPOPTS = 0x31
|
||||||
|
sysIPV6_DSTOPTS = 0x32
|
||||||
|
sysIPV6_RTHDR = 0x33
|
||||||
|
|
||||||
|
sysIPV6_RECVTCLASS = 0x39
|
||||||
|
|
||||||
|
sysIPV6_AUTOFLOWLABEL = 0x3b
|
||||||
|
|
||||||
|
sysIPV6_TCLASS = 0x3d
|
||||||
|
sysIPV6_DONTFRAG = 0x3e
|
||||||
|
|
||||||
|
sysIPV6_PREFER_TEMPADDR = 0x3f
|
||||||
|
|
||||||
|
sysIPV6_BINDANY = 0x40
|
||||||
|
|
||||||
|
sysIPV6_MSFILTER = 0x4a
|
||||||
|
|
||||||
|
sysMCAST_JOIN_GROUP = 0x50
|
||||||
|
sysMCAST_LEAVE_GROUP = 0x51
|
||||||
|
sysMCAST_JOIN_SOURCE_GROUP = 0x52
|
||||||
|
sysMCAST_LEAVE_SOURCE_GROUP = 0x53
|
||||||
|
sysMCAST_BLOCK_SOURCE = 0x54
|
||||||
|
sysMCAST_UNBLOCK_SOURCE = 0x55
|
||||||
|
|
||||||
|
sysIPV6_PORTRANGE_DEFAULT = 0x0
|
||||||
|
sysIPV6_PORTRANGE_HIGH = 0x1
|
||||||
|
sysIPV6_PORTRANGE_LOW = 0x2
|
||||||
|
|
||||||
|
sizeofSockaddrStorage = 0x80
|
||||||
|
sizeofSockaddrInet6 = 0x1c
|
||||||
|
sizeofInet6Pktinfo = 0x14
|
||||||
|
sizeofIPv6Mtuinfo = 0x20
|
||||||
|
|
||||||
|
sizeofIPv6Mreq = 0x14
|
||||||
|
sizeofGroupReq = 0x88
|
||||||
|
sizeofGroupSourceReq = 0x108
|
||||||
|
|
||||||
|
sizeofICMPv6Filter = 0x20
|
||||||
|
)
|
||||||
|
|
||||||
|
type sockaddrStorage struct {
|
||||||
|
Len uint8
|
||||||
|
Family uint8
|
||||||
|
X__ss_pad1 [6]uint8
|
||||||
|
X__ss_align int64
|
||||||
|
X__ss_pad2 [112]uint8
|
||||||
|
}
|
||||||
|
|
||||||
|
type sockaddrInet6 struct {
|
||||||
|
Len uint8
|
||||||
|
Family uint8
|
||||||
|
Port uint16
|
||||||
|
Flowinfo uint32
|
||||||
|
Addr [16]byte /* in6_addr */
|
||||||
|
Scope_id uint32
|
||||||
|
}
|
||||||
|
|
||||||
|
type inet6Pktinfo struct {
|
||||||
|
Addr [16]byte /* in6_addr */
|
||||||
|
Ifindex uint32
|
||||||
|
}
|
||||||
|
|
||||||
|
type ipv6Mtuinfo struct {
|
||||||
|
Addr sockaddrInet6
|
||||||
|
Mtu uint32
|
||||||
|
}
|
||||||
|
|
||||||
|
type ipv6Mreq struct {
|
||||||
|
Multiaddr [16]byte /* in6_addr */
|
||||||
|
Interface uint32
|
||||||
|
}
|
||||||
|
|
||||||
|
type groupReq struct {
|
||||||
|
Interface uint32
|
||||||
|
Group sockaddrStorage
|
||||||
|
}
|
||||||
|
|
||||||
|
type groupSourceReq struct {
|
||||||
|
Interface uint32
|
||||||
|
Group sockaddrStorage
|
||||||
|
Source sockaddrStorage
|
||||||
|
}
|
||||||
|
|
||||||
|
type icmpv6Filter struct {
|
||||||
|
Filt [8]uint32
|
||||||
|
}
|
||||||
|
|
@ -112,7 +112,7 @@ golang.org/x/crypto/ocsp
|
||||||
golang.org/x/crypto/pbkdf2
|
golang.org/x/crypto/pbkdf2
|
||||||
golang.org/x/crypto/pkcs12
|
golang.org/x/crypto/pkcs12
|
||||||
golang.org/x/crypto/pkcs12/internal/rc2
|
golang.org/x/crypto/pkcs12/internal/rc2
|
||||||
# golang.org/x/net v0.0.0-20190613194153-d28f0bde5980
|
# golang.org/x/net v0.0.0-20191112182307-2180aed22343
|
||||||
golang.org/x/net/bpf
|
golang.org/x/net/bpf
|
||||||
golang.org/x/net/context
|
golang.org/x/net/context
|
||||||
golang.org/x/net/context/ctxhttp
|
golang.org/x/net/context/ctxhttp
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue