Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PortForward ¶
func PortForward( ctx context.Context, dialer *net.Dialer, address string, protocol string, port int32, upstream io.Reader, packetReadBuf []byte, ) ( downstream io.ReadCloser, closeWrite func(), readErrCh <-chan error, err error, )
PortForward network traffic the parameters:
ctx is used to cancel dial operation dialer is optional for custom network dial options address is the endpoint address protocol is the protocol name, e.g. tcp, udp, tcp4 upstream is the data channel to the endpoint packetReadBuf is the buffer used for udp/ip/unix connection
the return values:
downstream is used to read data sent from the forwarded port and close connection closeWrite is intended to close write in stream oriented connection readErrCh is used to check read error and whether donwstream reading finished err if not nil the port forward failed
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.