Documentation
¶
Overview ¶
Package tcpclv4 provides a library for the Delay-Tolerant Networking TCP Convergence Layer Protocol Version 4, draft-ietf-dtn-tcpclv4-23.
A new TCPCLv4 server can be started by a TCPListener, which provides multiple connection to its Clients. To reach a remote server, a new Client connection can be dialed, see DialTCP.
Index ¶
- type Client
- func (client *Client) Address() string
- func (client *Client) Channel() chan cla.ConvergenceStatus
- func (client *Client) Close() error
- func (client *Client) GetEndpointID() bpv7.EndpointID
- func (client *Client) GetPeerEndpointID() bpv7.EndpointID
- func (client *Client) IsPermanent() bool
- func (client *Client) Send(b bpv7.Bundle) error
- func (client *Client) Start() (err error, retry bool)
- func (client *Client) String() string
- type TCPListener
- type WebSocketListener
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a TCPCLv4 client for a bidirectional Bundle exchange. Thus, the Client type implements both cla.ConvergenceReceiver and cla.ConvergenceSender.
A Client can be created by a Listener, e.g., a TCPListener, for incoming connections or dialed for outgoing connections, e.g., via DialTCP.
func DialTCP ¶
func DialTCP(address string, endpointID bpv7.EndpointID, permanent bool) *Client
DialTCP tries to establish a new TCPCLv4 Client to a remote TCPListener.
func DialWebSocket ¶
func DialWebSocket(address string, endpointID bpv7.EndpointID, permanent bool) *Client
DialWebSocket tries to establish a new TCPCLv4 Client to a remote WebSocketListener.
func (*Client) Address ¶
Address should return a unique address string to both identify this Client and ensure it will not opened twice.
func (*Client) Channel ¶
func (client *Client) Channel() chan cla.ConvergenceStatus
Channel represents a return channel for transmitted bundles, status messages, etc.
func (*Client) GetEndpointID ¶
func (client *Client) GetEndpointID() bpv7.EndpointID
GetEndpointID returns the endpoint ID assigned to this CLA.
func (*Client) GetPeerEndpointID ¶
func (client *Client) GetPeerEndpointID() bpv7.EndpointID
GetPeerEndpointID returns the endpoint ID assigned to this CLA's peer, if it's known. Otherwise the zero endpoint will be returned.
func (*Client) IsPermanent ¶
IsPermanent returns true, if this CLA should not be removed after failures.
type TCPListener ¶
type TCPListener struct {
// contains filtered or unexported fields
}
TCPListener is a TCPCLv4 server bound to a TCP port to accept incoming TCPCLv4 connections.
This type implements the cla.ConvergenceProvider and should be supervised by a cla.Manager.
func ListenTCP ¶
func ListenTCP(listenAddress string, endpointID bpv7.EndpointID) *TCPListener
ListenTCP creates a new TCPListener which should be bound to the given address and advertises the endpoint ID as its own node identifier.
func (*TCPListener) Close ¶
func (listener *TCPListener) Close() error
Close signals this TCPListener to shut down.
func (*TCPListener) RegisterManager ¶
func (listener *TCPListener) RegisterManager(manager *cla.Manager)
RegisterManager tells the TCPListener where to report new instances of cla.Convergence to.
func (*TCPListener) Start ¶
func (listener *TCPListener) Start() error
Start this TCPListener. Before being started, the the RegisterManager method tells this Client its cla.Manager. The cla.Manager will both call the RegisterManager and Start methods.
func (TCPListener) String ¶
func (listener TCPListener) String() string
type WebSocketListener ¶
type WebSocketListener struct {
// contains filtered or unexported fields
}
WebSocketListener is a TCPCLv4 server as a http.Handler to accept incoming TCPCLv4 connections via WebSockets.
This type implements the cla.ConvergenceProvider and should be supervised by a cla.Manager.
func ListenWebSocket ¶
func ListenWebSocket(endpointID bpv7.EndpointID) *WebSocketListener
ListenWebSocket creates a new WebSocketListener.
func (*WebSocketListener) Close ¶
func (listener *WebSocketListener) Close() error
Close this WebSocketListener.
func (*WebSocketListener) RegisterManager ¶
func (listener *WebSocketListener) RegisterManager(manager *cla.Manager)
RegisterManager tells the WebSocketListener where to report new instances of cla.Convergence to.
func (*WebSocketListener) ServeHTTP ¶
func (listener *WebSocketListener) ServeHTTP(writer http.ResponseWriter, request *http.Request)
ServeHTTP upgrades a HTTP connection to a WebSocket connection which is used for TCPCLv4.
func (*WebSocketListener) Start ¶
func (listener *WebSocketListener) Start() error
Start this WebSocketListener.
Directories
¶
Path | Synopsis |
---|---|
internal
|
|
msgs
Package msgs defines internal messages for the Delay-Tolerant Networking TCP Convergence Layer Protocol Version 4.
|
Package msgs defines internal messages for the Delay-Tolerant Networking TCP Convergence Layer Protocol Version 4. |
stages
Package stages contains internal stages of a TCPCLv4 session.
|
Package stages contains internal stages of a TCPCLv4 session. |
utils
Package utils provides encapsulated elements of a TCPCLv4 session.
|
Package utils provides encapsulated elements of a TCPCLv4 session. |