2eef3720a9
This commit contains the entire btcwire repository along with several changes needed to move all of the files into the wire directory in order to prepare it for merging. This does NOT update btcd or any of the other packages to use the new location as that will be done separately. - All import paths in the old btcwire test files have been changed to the new location - All references to btcwire as the package name have been chagned to wire - The coveralls badge has been removed since it unfortunately doesn't support coverage of sub-packages This is ongoing work toward #214.
62 lines
1.6 KiB
Go
62 lines
1.6 KiB
Go
// Copyright (c) 2013-2015 Conformal Systems LLC.
|
|
// Use of this source code is governed by an ISC
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package wire_test
|
|
|
|
import (
|
|
"net"
|
|
"time"
|
|
)
|
|
|
|
// fakeConn implements the net.Conn interface and is used to test functions
|
|
// which work with a net.Conn without having to actually make any real
|
|
// connections.
|
|
type fakeConn struct {
|
|
localAddr net.Addr
|
|
remoteAddr net.Addr
|
|
}
|
|
|
|
// Read doesn't do anything. It just satisfies the net.Conn interface.
|
|
func (c *fakeConn) Read(b []byte) (n int, err error) {
|
|
return 0, nil
|
|
}
|
|
|
|
// Write doesn't do anything. It just satisfies the net.Conn interface.
|
|
func (c *fakeConn) Write(b []byte) (n int, err error) {
|
|
return 0, nil
|
|
}
|
|
|
|
// Close doesn't do anything. It just satisfies the net.Conn interface.
|
|
func (c *fakeConn) Close() error {
|
|
return nil
|
|
}
|
|
|
|
// LocalAddr returns the localAddr field of the fake connection and satisfies
|
|
// the net.Conn interface.
|
|
func (c *fakeConn) LocalAddr() net.Addr {
|
|
return c.localAddr
|
|
}
|
|
|
|
// RemoteAddr returns the remoteAddr field of the fake connection and satisfies
|
|
// the net.Conn interface.
|
|
func (c *fakeConn) RemoteAddr() net.Addr {
|
|
return c.remoteAddr
|
|
}
|
|
|
|
// SetDeadline doesn't do anything. It just satisfies the net.Conn interface.
|
|
func (c *fakeConn) SetDeadline(t time.Time) error {
|
|
return nil
|
|
}
|
|
|
|
// SetReadDeadline doesn't do anything. It just satisfies the net.Conn
|
|
// interface.
|
|
func (c *fakeConn) SetReadDeadline(t time.Time) error {
|
|
return nil
|
|
}
|
|
|
|
// SetWriteDeadline doesn't do anything. It just satisfies the net.Conn
|
|
// interface.
|
|
func (c *fakeConn) SetWriteDeadline(t time.Time) error {
|
|
return nil
|
|
}
|