2
0
mirror of https://github.com/soheilhy/cmux.git synced 2024-11-10 03:31:52 +08:00
cmux.go:28:1: exported method ErrNotMatched.Temporary should have comment or be unexported
cmux.go:29:1: exported method ErrNotMatched.Timeout should have comment or be unexported
cmux.go:38:2: exported var ErrListenerClosed should have comment or be unexported
cmux.go:165:6: exported type MuxConn should have comment or be unexported
This commit is contained in:
Tamir Duberstein 2016-01-07 10:08:59 -05:00 committed by Soheil Hassas Yeganeh
parent 05566d752e
commit 48deeb47a3
2 changed files with 15 additions and 1 deletions

View File

@ -3,3 +3,9 @@ language: go
go: go:
- 1.3 - 1.3
- 1.4 - 1.4
before_install:
- go get -u github.com/golang/lint/golint
before_script:
- golint ./...

View File

@ -13,6 +13,8 @@ type Matcher func(r io.Reader) (ok bool)
// the mux should continue serving the listener. // the mux should continue serving the listener.
type ErrorHandler func(err error) (ok bool) type ErrorHandler func(err error) (ok bool)
var _ net.Error = ErrNotMatched{}
// ErrNotMatched is returned whenever a connection is not matched by any of // ErrNotMatched is returned whenever a connection is not matched by any of
// the matchers registered in the multiplexer. // the matchers registered in the multiplexer.
type ErrNotMatched struct { type ErrNotMatched struct {
@ -24,7 +26,10 @@ func (e ErrNotMatched) Error() string {
e.c.RemoteAddr()) e.c.RemoteAddr())
} }
// Temporary implements the net.Error interface.
func (e ErrNotMatched) Temporary() bool { return true } func (e ErrNotMatched) Temporary() bool { return true }
// Timeout implements the net.Error interface.
func (e ErrNotMatched) Timeout() bool { return false } func (e ErrNotMatched) Timeout() bool { return false }
type errListenerClosed string type errListenerClosed string
@ -34,6 +39,8 @@ func (e errListenerClosed) Temporary() bool { return false }
func (e errListenerClosed) Timeout() bool { return false } func (e errListenerClosed) Timeout() bool { return false }
var ( var (
// ErrListenerClosed is returned from muxListener.Accept when the underlying
// listener is closed.
ErrListenerClosed = errListenerClosed("mux: listener closed") ErrListenerClosed = errListenerClosed("mux: listener closed")
) )
@ -157,6 +164,7 @@ func (l muxListener) Accept() (c net.Conn, err error) {
} }
} }
// MuxConn wraps a net.Conn and provides transparent sniffing of connection data.
type MuxConn struct { type MuxConn struct {
net.Conn net.Conn
buf buffer buf buffer