adapter

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartAdapter

func StartAdapter(a AbstractAdapter, c chan []byte)

StartAdapter ...

Types

type AbstractAdapter

type AbstractAdapter interface {
	Start()
	Input(c chan []byte)
	Output(c chan []byte)
	GetDirection() Direction
}

AbstractAdapter ...(I)

type Adapter

type Adapter struct {
	Direction
	Host     string
	Port     int
	Protocol Protocol
}

Adapter ...(T1)

func NewAdapter

func NewAdapter(direction Direction, host string, port int, protocol Protocol) *Adapter

NewAdapter ...

func (*Adapter) GetDirection

func (a *Adapter) GetDirection() Direction

func (*Adapter) Input

func (a *Adapter) Input(c chan []byte)

func (*Adapter) Output

func (a *Adapter) Output(c chan []byte)

func (*Adapter) Start

func (a *Adapter) Start()

Abstract interface

type Direction

type Direction int

Direction ...

const (
	Input Direction = iota + 1
	Output
)

type HTTPAdapter

type HTTPAdapter struct {
	*Adapter
	Path        string
	ContentType string
	// contains filtered or unexported fields
}

HTTPAdapter ...

func NewHTTPAdapter

func NewHTTPAdapter(direction Direction, host string, port int, path, contentType string) *HTTPAdapter

NewHTTPAdapter ...

func (*HTTPAdapter) Input

func (httpAdapter *HTTPAdapter) Input(c chan []byte)

Input = create server ...

func (*HTTPAdapter) Output

func (httpAdapter *HTTPAdapter) Output(c chan []byte)

Output = HTTP POST ...

func (*HTTPAdapter) Start

func (httpAdapter *HTTPAdapter) Start()

Start ...

type TCPAdapter

type TCPAdapter struct {
	*Adapter
	Delimiter byte
	Conn      net.Conn
}

TCPAdapter ... (T2)

func NewTCPAdapter

func NewTCPAdapter(direction Direction, host string, port int, delimiter byte) *TCPAdapter

NewTCPAdapter ...

func (*TCPAdapter) Input

func (tcp *TCPAdapter) Input(c chan []byte)

Input = create server ...

func (*TCPAdapter) Output

func (tcp *TCPAdapter) Output(c chan []byte)

Output = connect to server ...

func (*TCPAdapter) Start

func (tcp *TCPAdapter) Start()

Start ...

type UDPAdapter

type UDPAdapter struct {
	*Adapter
	Delimiter byte
	Conn      net.Conn
}

UDPAdapter ... (T2)

func NewUDPAdapter

func NewUDPAdapter(direction Direction, host string, port int, delimiter byte) *UDPAdapter

NewUDPAdapter ...

func (*UDPAdapter) Input

func (udp *UDPAdapter) Input(c chan []byte)

Input = create server ...

func (*UDPAdapter) Output

func (udp *UDPAdapter) Output(c chan []byte)

Output = connect to server ...

func (*UDPAdapter) Start

func (udp *UDPAdapter) Start()

Start ...

type WSAdapter

type WSAdapter struct {
	*Adapter
	Path string
	// contains filtered or unexported fields
}

WSAdapter ...

func NewWSAdapter

func NewWSAdapter(direction Direction, host string, port int, path string) *WSAdapter

NewWSAdapter ...

func (*WSAdapter) Input

func (ws *WSAdapter) Input(c chan []byte)

Input = create server ...

func (*WSAdapter) Output

func (ws *WSAdapter) Output(c chan []byte)

Output = connect to server ...

func (*WSAdapter) Start

func (ws *WSAdapter) Start()

Start ...

Jump to

Keyboard shortcuts

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