pipe

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2023 License: GPL-3.0 Imports: 9 Imported by: 2

Documentation

Overview

Package pipe contains a cross-device compatable Pipes/NamedPipes connection interface. This package differs from the standard library as it allows for setting permissions on the Pipes without any OS-specific functions.

Index

Constants

View Source
const Pipe = Piper(time.Second * 15)

Pipe is the default Connector with the default timeout of 15 seconds.

Variables

View Source
var PermEveryone = "0766"

PermEveryone is the Linux permission string used in sockets to allow anyone to write and read to the listening socket. This can be used for socket communication between privilege boundaries. This can be applied to the ListenPerm function.

Functions

func Dial

func Dial(path string) (net.Conn, error)

Dial connects to the specified Pipe path. This function will return a 'net.Conn' instance or any errors that may occur during the connection attempt.

Pipe names are in the form of "/<path>".

This function blocks indefinitely. Use the DialTimeout or DialContext to specify a control method.

func DialContext

func DialContext(x context.Context, path string) (net.Conn, error)

DialContext connects to the specified Pipe path. This function will return a net.Conn instance or any errors that may occur during the connection attempt.

Pipe names are in the form of "/<path>".

This function blocks until the supplied context is canceled and will return the context's Err() if the cancel occurs before the connection.

func DialTimeout

func DialTimeout(path string, t time.Duration) (net.Conn, error)

DialTimeout connects to the specified Pipe path. This function will return a net.Conn instance or any errors that may occur during the connection attempt.

Pipe names are in the form of "/<path>".

This function blocks for the specified amount of time and will return 'ErrTimeout' if the timeout is reached.

func Format

func Format(s string) string

Format will ensure the path for this Pipe socket fits the proper OS based pathname. Valid path names will be returned without any changes.

func Listen

func Listen(path string) (net.Listener, error)

Listen returns a 'net.Listener' that will listen for new connections on the Named Pipe path specified or any errors that may occur during listener creation.

Pipe names are in the form of "/<path>".

func ListenContext added in v0.2.0

func ListenContext(x context.Context, path string) (net.Listener, error)

ListenContext returns a 'net.Listener' that will listen for new connections on the Named Pipe path specified or any errors that may occur during listener creation.

Pipe names are in the form of "/<path>".

The provided Context can be used to cancel the Listener.

func ListenPerms

func ListenPerms(path, perms string) (net.Listener, error)

ListenPerms returns a Listener that will listen for new connections on the Named Pipe path specified or any errors that may occur during listener creation.

Pipe names are in the form of "/<path>".

This function allows for specifying a Linux permissions string used to set the permissions of the listening Pipe.

func ListenPermsContext added in v0.2.0

func ListenPermsContext(x context.Context, path, perms string) (net.Listener, error)

ListenPermsContext returns a Listener that will listen for new connections on the Named Pipe path specified or any errors that may occur during listener creation.

Pipe names are in the form of "/".

This function allows for specifying a Linux permissions string used to set the permissions of the listening Pipe.

The provided Context can be used to cancel the Listener.

Types

type Piper added in v0.1.0

type Piper time.Duration

Piper is a Connector that can be used with the 'c2' package to make Pipe connections for C2.

func (Piper) Connect added in v0.1.0

func (p Piper) Connect(x context.Context, a string) (net.Conn, error)

Connect fulfills the Connector interface.

func (Piper) Listen added in v0.1.0

func (Piper) Listen(x context.Context, a string) (net.Listener, error)

Listen fulfills the Connector interface.

Jump to

Keyboard shortcuts

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