bytecounting

package
v0.0.0-...-8b1022e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2016 License: Apache-2.0, Apache-2.0 Imports: 2 Imported by: 0

README

bytecounting Travis CI Status Coverage Status GoDoc

go library for counting bytes read/written on net.Conn and net.Listener.

GoDoc

Documentation

Overview

package bytecounting provides mechanisms for counting bytes read/written on net.Conn and net.Listener.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn struct {
	Orig    net.Conn
	OnRead  func(bytes int64)
	OnWrite func(bytes int64)
}

Conn is a net.Conn that wraps another net.Conn and counts bytes read/written by reporting them to callback functions.

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) LocalAddr

func (c *Conn) LocalAddr() net.Addr

func (*Conn) Read

func (c *Conn) Read(b []byte) (int, error)

Read implements the method from io.Reader

func (*Conn) RemoteAddr

func (c *Conn) RemoteAddr() net.Addr

func (*Conn) SetDeadline

func (c *Conn) SetDeadline(t time.Time) error

func (*Conn) SetReadDeadline

func (c *Conn) SetReadDeadline(t time.Time) error

func (*Conn) SetWriteDeadline

func (c *Conn) SetWriteDeadline(t time.Time) error

func (*Conn) Write

func (c *Conn) Write(b []byte) (int, error)

Write implements the method from io.Reader

type Listener

type Listener struct {
	Orig    net.Listener
	OnRead  func(bytes int64)
	OnWrite func(bytes int64)
}

Listener is a net.Listener that wraps another net.Listener and wraps its net.Conns in bytecounting.Conn to track bytes read/written.

func (*Listener) Accept

func (l *Listener) Accept() (c net.Conn, err error)

func (*Listener) Addr

func (l *Listener) Addr() net.Addr

func (*Listener) Close

func (l *Listener) Close() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL