@@ -8,6 +8,7 @@ package testutils
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net"
|
||||
"sync"
|
||||
)
|
||||
|
||||
@@ -52,3 +53,49 @@ func (rw *NoopRW) Read(p []byte) (n int, err error) {
|
||||
func (rw *NoopRW) Write(p []byte) (n int, err error) {
|
||||
return len(p), nil
|
||||
}
|
||||
|
||||
type NoopCloser struct{}
|
||||
|
||||
func (NoopCloser) Close() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// FakeConnectionInfo implements the methods of protocol.Connection that are
|
||||
// not implemented by protocol.Connection
|
||||
type FakeConnectionInfo struct {
|
||||
Name string
|
||||
}
|
||||
|
||||
func (f *FakeConnectionInfo) RemoteAddr() net.Addr {
|
||||
return &FakeAddr{}
|
||||
}
|
||||
|
||||
func (f *FakeConnectionInfo) Type() string {
|
||||
return "fake"
|
||||
}
|
||||
|
||||
func (f *FakeConnectionInfo) Crypto() string {
|
||||
return "fake"
|
||||
}
|
||||
|
||||
func (f *FakeConnectionInfo) Transport() string {
|
||||
return "fake"
|
||||
}
|
||||
|
||||
func (f *FakeConnectionInfo) Priority() int {
|
||||
return 9000
|
||||
}
|
||||
|
||||
func (f *FakeConnectionInfo) String() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
type FakeAddr struct{}
|
||||
|
||||
func (FakeAddr) Network() string {
|
||||
return "network"
|
||||
}
|
||||
|
||||
func (FakeAddr) String() string {
|
||||
return "address"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user