goscatter

package module
v0.0.0-...-b838711 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2018 License: MIT Imports: 8 Imported by: 0

README

tcp-scatter

Build Status GoDoc Go Report Card

Small tool to broadcast tcp connection.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Scatter

type Scatter struct {
	// contains filtered or unexported fields
}

Scatter is used to passing data between c, mainConn and scatterConns.

Data reads from c will be write to mainConn and all scatterConns. Data reads from mainConn will be write to c. Data reads from scatterConns will be droped.

Scatter will stops when c or mainConn closed. And will not stop when any of scatterConns closed.

func NewScatter

func NewScatter(conn net.Conn, mainAddr string, scatterAddrs []string) (*Scatter, error)

NewScatter creates Scatter used to pass messages between conn and connections created by mainAddr and scatterAddrs.

func (*Scatter) Run

func (s *Scatter) Run() error

Run the scatter and pass data.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is used to manage scatters. When receiving a connection, server will create a Scatter to send and receive messages to remote address.

func NewServer

func NewServer(port int, remoteAddr string) (*Server, error)

NewServer creates Server using port and remoteAddr.

func (*Server) AddScatterAddr

func (s *Server) AddScatterAddr(scatterAddr string) error

AddScatterAddr add a scatter address to the server.

func (*Server) Run

func (s *Server) Run() error

Run the server to receive connections.

func (*Server) Stop

func (s *Server) Stop()

Stop the server.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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