log: add a default implement of func F

This commit is contained in:
nadoo committed 2018-06-26 17:00:13 +08:00
1 parent 3adf3b30b5
commit 36246d9d08
7 files changed
+29 -8

No files matched your search

+7
View File
@@ -9,29 +9,36 @@ import (
"github.com/nadoo/glider/common/log"
)
// UDPBufSize is the size of udp buffer
const UDPBufSize = 65536
// Conn struct
type Conn struct {
r *bufio.Reader
net.Conn
}
// NewConn .
func NewConn(c net.Conn) Conn {
return Conn{bufio.NewReader(c), c}
}
// NewConnSize .
func NewConnSize(c net.Conn, n int) Conn {
return Conn{bufio.NewReaderSize(c, n), c}
}
// Peek .
func (c Conn) Peek(n int) ([]byte, error) {
return c.r.Peek(n)
}
// Read .
func (c Conn) Read(p []byte) (int, error) {
return c.r.Read(p)
}
// Relay .
func Relay(left, right net.Conn) (int64, int64, error) {
type res struct {
N int64