net

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIllegalPurpose = errors.Config.Newf("illegal purpose")
)
View Source
var (
	ErrNotifyClosedUnsupported = errors.Network.Newf("notify closed is not supported for this connection")
)

Functions

func AsListener added in v0.4.0

func AsListener[C gonet.Conn](
	accept func() (C, error),
	close func() error,
	addr func() string,
) (gonet.Listener, error)

func ConnectToNamedPipe added in v0.4.0

func ConnectToNamedPipe(ctx context.Context, path string) (gonet.Conn, error)

func NewNamedPipeId added in v0.4.0

func NewNamedPipeId() (string, error)

func NotifyClosed added in v0.4.0

func NotifyClosed(conn gonet.Conn, onClosed func(), onUnexpectedEnd func(error))

Types

type CloseWriterConn added in v0.4.0

type CloseWriterConn interface {
	gonet.Conn
	sys.CloseWriter
}

func AsCloseWriterConn added in v0.4.0

func AsCloseWriterConn(conn gonet.Conn) CloseWriterConn

type Host

type Host struct {
	IP  gonet.IP
	Dns string
}

func MustNewHost added in v0.4.0

func MustNewHost(in string) Host

func NewHost added in v0.4.0

func NewHost(in string) (result Host, err error)

func (Host) Clone

func (this Host) Clone() Host

func (Host) IsEqualTo added in v0.4.0

func (this Host) IsEqualTo(other any) bool

func (Host) IsZero added in v0.4.0

func (this Host) IsZero() bool

func (Host) MarshalText

func (this Host) MarshalText() ([]byte, error)

func (*Host) Set

func (this *Host) Set(in string) error

func (*Host) SetNetAddr

func (this *Host) SetNetAddr(in gonet.Addr) error

func (Host) String

func (this Host) String() string

func (*Host) UnmarshalText

func (this *Host) UnmarshalText(in []byte) error

func (Host) Validate added in v0.4.0

func (this Host) Validate() error

func (Host) WithPort added in v0.4.0

func (this Host) WithPort(port uint16) (HostPort, error)

type HostPort added in v0.4.0

type HostPort struct {
	Host Host
	Port uint16
}

func MustNewHostPort added in v0.4.0

func MustNewHostPort(in string) HostPort

func NewHostPort added in v0.4.0

func NewHostPort(in string) (result HostPort, err error)

func (HostPort) Clone added in v0.4.0

func (this HostPort) Clone() HostPort

func (HostPort) IsEqualTo added in v0.4.0

func (this HostPort) IsEqualTo(other any) bool

func (HostPort) IsZero added in v0.4.0

func (this HostPort) IsZero() bool

func (HostPort) MarshalText added in v0.4.0

func (this HostPort) MarshalText() ([]byte, error)

func (*HostPort) Set added in v0.4.0

func (this *HostPort) Set(in string) error

func (HostPort) String added in v0.4.0

func (this HostPort) String() string

func (*HostPort) UnmarshalText added in v0.4.0

func (this *HostPort) UnmarshalText(in []byte) error

func (HostPort) Validate added in v0.4.0

func (this HostPort) Validate() error

type NamedPipe added in v0.4.0

type NamedPipe interface {
	gonet.Listener
	AcceptConn() (CloseWriterConn, error)
	Path() string
}

func AsNamedPipe added in v0.4.0

func AsNamedPipe(ln gonet.Listener, path string) (NamedPipe, error)

func NewNamedPipe added in v0.4.0

func NewNamedPipe(purpose Purpose) (NamedPipe, error)

func NewNamedPipeWithId added in v0.4.0

func NewNamedPipeWithId(purpose Purpose, id string) (result NamedPipe, err error)

type NetAddress

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

func MustNewNetAddress

func MustNewNetAddress(plain string) NetAddress

func NewNetAddress

func NewNetAddress(plain string) (NetAddress, error)

func (NetAddress) Get

func (this NetAddress) Get() gonet.Addr

func (NetAddress) IsEqualTo

func (this NetAddress) IsEqualTo(other any) bool

func (NetAddress) IsZero

func (this NetAddress) IsZero() bool

func (NetAddress) Listen

func (this NetAddress) Listen() (gonet.Listener, error)

func (NetAddress) MarshalText

func (this NetAddress) MarshalText() (text []byte, err error)

func (*NetAddress) Set

func (this *NetAddress) Set(text string) error

func (NetAddress) String

func (this NetAddress) String() string

func (*NetAddress) UnmarshalText

func (this *NetAddress) UnmarshalText(text []byte) error

type NetAddresses

type NetAddresses []NetAddress

func (NetAddresses) IsEqualTo

func (this NetAddresses) IsEqualTo(other any) bool

func (*NetAddresses) Trim

func (this *NetAddresses) Trim() error

func (*NetAddresses) Validate

func (this *NetAddresses) Validate() error

type Purpose added in v0.4.0

type Purpose string

func (Purpose) Clone added in v0.4.0

func (this Purpose) Clone() Purpose

func (Purpose) IsEqualTo added in v0.4.0

func (this Purpose) IsEqualTo(other any) bool

func (Purpose) IsZero added in v0.4.0

func (this Purpose) IsZero() bool

func (Purpose) MarshalText added in v0.4.0

func (this Purpose) MarshalText() ([]byte, error)

func (*Purpose) Set added in v0.4.0

func (this *Purpose) Set(in string) error

func (Purpose) String added in v0.4.0

func (this Purpose) String() string

func (*Purpose) UnmarshalText added in v0.4.0

func (this *Purpose) UnmarshalText(in []byte) error

func (Purpose) Validate added in v0.4.0

func (this Purpose) Validate() error

type Remote added in v0.4.0

type Remote interface {
	User() string
	Host() Host
	String() string
}

Jump to

Keyboard shortcuts

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