winio

package module
v0.4.15 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2020 License: MIT Imports: 13 Imported by: 0

README

go-winio

This repository contains utilities for efficiently performing Win32 IO operations in Go. Currently, this is focused on accessing named pipes and other file handles, and for using named pipes as a net transport.

This code relies on IO completion ports to avoid blocking IO on system threads, allowing Go to reuse the thread to schedule another goroutine. This limits support to Windows Vista and newer operating systems. This is similar to the implementation of network sockets in Go's net package.

Please see the LICENSE file for licensing information.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Thanks to natefinch for the inspiration for this library. See https://github.com/natefinch/npipe for another named pipe implementation.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeExtendedAttributes added in v0.4.5

func EncodeExtendedAttributes(eas []ExtendedAttribute) ([]byte, error)

EncodeExtendedAttributes encodes a list of EAs into a FILE_FULL_EA_INFORMATION buffer for use with BackupWrite, ZwSetEaFile, etc.

func EncodeReparsePoint

func EncodeReparsePoint(rp *ReparsePoint) []byte

EncodeReparsePoint encodes a Win32 REPARSE_DATA_BUFFER structure describing a symlink or mount point.

func VsockServiceID added in v0.4.15

func VsockServiceID(port uint32) guid.GUID

VsockServiceID returns an hvsock service ID corresponding to the specified AF_VSOCK port.

Types

type ExtendedAttribute added in v0.4.5

type ExtendedAttribute struct {
	Name  string
	Value []byte
	Flags uint8
}

ExtendedAttribute represents a single Windows EA.

func DecodeExtendedAttributes added in v0.4.5

func DecodeExtendedAttributes(b []byte) (eas []ExtendedAttribute, err error)

DecodeExtendedAttributes decodes a list of EAs from a FILE_FULL_EA_INFORMATION buffer retrieved from BackupRead, ZwQueryEaFile, etc.

type HvsockAddr added in v0.4.15

type HvsockAddr struct {
	VMID      guid.GUID
	ServiceID guid.GUID
}

An HvsockAddr is an address for a AF_HYPERV socket.

func (*HvsockAddr) Network added in v0.4.15

func (addr *HvsockAddr) Network() string

Network returns the address's network name, "hvsock".

func (*HvsockAddr) String added in v0.4.15

func (addr *HvsockAddr) String() string

type HvsockConn added in v0.4.15

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

HvsockConn is a connected socket of the AF_HYPERV address family.

func (*HvsockConn) Close added in v0.4.15

func (conn *HvsockConn) Close() error

Close closes the socket connection, failing any pending read or write calls.

func (*HvsockConn) CloseRead added in v0.4.15

func (conn *HvsockConn) CloseRead() error

CloseRead shuts down the read end of the socket.

func (*HvsockConn) CloseWrite added in v0.4.15

func (conn *HvsockConn) CloseWrite() error

CloseWrite shuts down the write end of the socket, notifying the other endpoint that no more data will be written.

func (*HvsockConn) LocalAddr added in v0.4.15

func (conn *HvsockConn) LocalAddr() net.Addr

LocalAddr returns the local address of the connection.

func (*HvsockConn) Read added in v0.4.15

func (conn *HvsockConn) Read(b []byte) (int, error)

func (*HvsockConn) RemoteAddr added in v0.4.15

func (conn *HvsockConn) RemoteAddr() net.Addr

RemoteAddr returns the remote address of the connection.

func (*HvsockConn) SetDeadline added in v0.4.15

func (conn *HvsockConn) SetDeadline(t time.Time) error

SetDeadline implements the net.Conn SetDeadline method.

func (*HvsockConn) SetReadDeadline added in v0.4.15

func (conn *HvsockConn) SetReadDeadline(t time.Time) error

SetReadDeadline implements the net.Conn SetReadDeadline method.

func (*HvsockConn) SetWriteDeadline added in v0.4.15

func (conn *HvsockConn) SetWriteDeadline(t time.Time) error

SetWriteDeadline implements the net.Conn SetWriteDeadline method.

func (*HvsockConn) Write added in v0.4.15

func (conn *HvsockConn) Write(b []byte) (int, error)

type HvsockListener added in v0.4.15

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

HvsockListener is a socket listener for the AF_HYPERV address family.

func ListenHvsock added in v0.4.15

func ListenHvsock(addr *HvsockAddr) (_ *HvsockListener, err error)

ListenHvsock listens for connections on the specified hvsock address.

func (*HvsockListener) Accept added in v0.4.15

func (l *HvsockListener) Accept() (_ net.Conn, err error)

Accept waits for the next connection and returns it.

func (*HvsockListener) Addr added in v0.4.15

func (l *HvsockListener) Addr() net.Addr

Addr returns the listener's network address.

func (*HvsockListener) Close added in v0.4.15

func (l *HvsockListener) Close() error

Close closes the listener, causing any pending Accept calls to fail.

type ReparsePoint

type ReparsePoint struct {
	Target       string
	IsMountPoint bool
}

ReparsePoint describes a Win32 symlink or mount point.

func DecodeReparsePoint

func DecodeReparsePoint(b []byte) (*ReparsePoint, error)

DecodeReparsePoint decodes a Win32 REPARSE_DATA_BUFFER structure containing either a symlink or a mount point.

func DecodeReparsePointData added in v0.3.0

func DecodeReparsePointData(tag uint32, b []byte) (*ReparsePoint, error)

type UnsupportedReparsePointError

type UnsupportedReparsePointError struct {
	Tag uint32
}

UnsupportedReparsePointError is returned when trying to decode a non-symlink or mount point reparse point.

func (*UnsupportedReparsePointError) Error

Directories

Path Synopsis
archive
tar
Package tar implements access to tar archives.
Package tar implements access to tar archives.
pkg
etw
Package etw provides support for TraceLogging-based ETW (Event Tracing for Windows).
Package etw provides support for TraceLogging-based ETW (Event Tracing for Windows).
etw/sample
Shows a sample usage of the ETW logging package.
Shows a sample usage of the ETW logging package.
fs
guid
Package guid provides a GUID type.
Package guid provides a GUID type.
tools
wim
Package wim implements a WIM file parser.
Package wim implements a WIM file parser.
lzx
Package lzx implements a decompressor for the the WIM variant of the LZX compression algorithm.
Package lzx implements a decompressor for the the WIM variant of the LZX compression algorithm.

Jump to

Keyboard shortcuts

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