namedpipe

package
v0.0.0-...-5f26479 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Rendered for windows/amd64

Overview

Package namedpipe implements a net.Conn and net.Listener around Windows named pipes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DialContext

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

DialContext calls DialConfig.DialContext using an empty configuration.

func DialTimeout

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

DialTimeout calls DialConfig.DialTimeout using an empty configuration.

func Listen

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

Listen calls ListenConfig.Listen using an empty configuration.

Types

type DialConfig

type DialConfig struct {
	ExpectedOwner *windows.SID // If non-nil, the pipe is verified to be owned by this SID.
}

DialConfig exposes various options for use in Dial and DialContext.

func (*DialConfig) DialContext

func (config *DialConfig) DialContext(ctx context.Context, path string) (net.Conn, error)

DialContext attempts to connect to the specified named pipe by path.

func (*DialConfig) DialTimeout

func (config *DialConfig) DialTimeout(path string, timeout time.Duration) (net.Conn, error)

DialTimeout connects to the specified named pipe by path, timing out if the connection takes longer than the specified duration. If timeout is zero, then we use a default timeout of 2 seconds.

type ListenConfig

type ListenConfig struct {
	// SecurityDescriptor contains a Windows security descriptor. If nil, the default from RtlDefaultNpAcl is used.
	SecurityDescriptor *windows.SECURITY_DESCRIPTOR

	// MessageMode determines whether the pipe is in byte or message mode. In either
	// case the pipe is read in byte mode by default. The only practical difference in
	// this implementation is that CloseWrite is only supported for message mode pipes;
	// CloseWrite is implemented as a zero-byte write, but zero-byte writes are only
	// transferred to the reader (and returned as io.EOF in this implementation)
	// when the pipe is in message mode.
	MessageMode bool

	// InputBufferSize specifies the initial size of the input buffer, in bytes, which the OS will grow as needed.
	InputBufferSize int32

	// OutputBufferSize specifies the initial size of the output buffer, in bytes, which the OS will grow as needed.
	OutputBufferSize int32
}

ListenConfig contains configuration for the pipe listener.

func (*ListenConfig) Listen

func (c *ListenConfig) Listen(path string) (net.Listener, error)

Listen creates a listener on a Windows named pipe path,such as \\.\pipe\mypipe. The pipe must not already exist.

Jump to

Keyboard shortcuts

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