RelpDialer

package
v0.0.0-...-c23723d Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RelpDialer

type RelpDialer interface {
	// Dial dials to the given hostname and port, providing the tls.Config if necessary. Returns if the connection is encrypted, and
	// if any errors were encountered.
	Dial(hostname string, port int, cfg *tls.Config) (bool, error)
	// SetReadDeadline sets the deadline for reading operations. The duration is added on top of current time.
	SetReadDeadline(add time.Duration) error
	// SetWriteDeadline sets the deadline for writing operations. The duration is added on top of current time.
	SetWriteDeadline(add time.Duration) error
	// Write writes the src byte array to the connection. Returns the written amount of bytes and any possible errors.
	Write(src []byte) (int, error)
	// Read reads the data from the connection to the dest byte array. Returns the amount of bytes read and any possible errors.
	Read(dest []byte) (int, error)
	// Close closes the connection, returning any possible errors.
	Close() error
}

RelpDialer is the interface for all the methods RELP dialers should contain. Check RelpPlainDialer and RelpTLSDialer for implementations.

type RelpPlainDialer

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

RelpPlainDialer contains the net.Conn struct used for unencrypted connections.

func (*RelpPlainDialer) Close

func (relpd *RelpPlainDialer) Close() error

Close closes the connection

func (*RelpPlainDialer) Dial

func (relpd *RelpPlainDialer) Dial(hostname string, port int, _ *tls.Config) (bool, error)

Dial connects to the specified hostname and port Returns boolean if the connection is encrypted or not and possible errors as the second return value.

func (*RelpPlainDialer) Read

func (relpd *RelpPlainDialer) Read(dest []byte) (int, error)

Read reads the incoming data to the specified byte array

func (*RelpPlainDialer) SetReadDeadline

func (relpd *RelpPlainDialer) SetReadDeadline(dur time.Duration) error

SetReadDeadline sets the deadline for reading. The given duration is added on current time.

func (*RelpPlainDialer) SetWriteDeadline

func (relpd *RelpPlainDialer) SetWriteDeadline(dur time.Duration) error

SetWriteDeadline sets the deadline for writing. The given duration is added on current time.

func (*RelpPlainDialer) Write

func (relpd *RelpPlainDialer) Write(src []byte) (int, error)

Write writes the byte array to the connection

type RelpTLSDialer

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

RelpTLSDialer contains the encrypted tls.Conn connection struct

func (*RelpTLSDialer) Close

func (relpd *RelpTLSDialer) Close() error

Close closes the connection.

func (*RelpTLSDialer) Dial

func (relpd *RelpTLSDialer) Dial(hostname string, port int, cfg *tls.Config) (bool, error)

Dial sets up the encrypted connection using the given tls.Config Returns boolean if the connection is encrypted or not and possible errors as the second return value.

func (*RelpTLSDialer) Read

func (relpd *RelpTLSDialer) Read(dest []byte) (int, error)

Read reads the data from the connection to the given byte array

func (*RelpTLSDialer) SetReadDeadline

func (relpd *RelpTLSDialer) SetReadDeadline(dur time.Duration) error

SetReadDeadline sets the deadline for reading operations. The duration is added on current time.

func (*RelpTLSDialer) SetWriteDeadline

func (relpd *RelpTLSDialer) SetWriteDeadline(dur time.Duration) error

SetWriteDeadline sets the deadline for writing operations. The duration is added on current time.

func (*RelpTLSDialer) Write

func (relpd *RelpTLSDialer) Write(src []byte) (int, error)

Write writes the given byte array to the connection

Jump to

Keyboard shortcuts

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