Generated from Manticore v1.1.5 • 201 packages. View on pkg.go.dev

tcp

import "github.com/TheManticoreProject/Manticore/network/tcp"

Index

Constants

MaxDirectTCPPayloadSize caps the payload size accepted from a single Direct TCP frame. The Direct TCP session service length field is 24 bits wide (up to ~16 MiB), but SMB1 negotiates a MaxBufferSize of at most a few tens of kilobytes in practice. 1 MiB is a generous upper bound that rejects DoS-scale frames without blocking legitimate traffic.

const MaxDirectTCPPayloadSize = 1 * 1024 * 1024

type TCPTransport

TCPTransport implements the Transport interface for Direct TCP transport Source: https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-smb/f906c680-330c-43ae-9a71-f854e24aeee6

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

func NewTCPTransport

func NewTCPTransport() *TCPTransport

NewTCPTransport creates a new Direct TCP transport

func (*TCPTransport) Close

func (t *TCPTransport) Close() error

Close terminates the Direct TCP connection

func (*TCPTransport) Connect

func (t *TCPTransport) Connect(ipaddr net.IP, port int) error

Connect establishes a Direct TCP connection

func (*TCPTransport) IsConnected

func (t *TCPTransport) IsConnected() bool

IsConnected returns whether the Direct TCP transport is currently connected

func (*TCPTransport) Receive

func (t *TCPTransport) Receive() ([]byte, error)

Receive reads data from the Direct TCP connection, handling the Direct TCP header

func (*TCPTransport) Send

func (t *TCPTransport) Send(data []byte) (int, error)

Send transmits data over the Direct TCP connection with proper Direct TCP header

func (*TCPTransport) SetTimeout

func (t *TCPTransport) SetTimeout(d time.Duration)

SetTimeout bounds Connect and each subsequent Receive: Connect fails if the TCP connection cannot be established within d, and Receive fails if a frame does not arrive within d. A non-positive d removes the bound (blocking I/O).