net

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 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 Address added in v0.5.0

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

func MustNewAddress added in v0.5.0

func MustNewAddress(plain string) Address

func NewAddress added in v0.5.0

func NewAddress(plain string) (Address, error)

func (Address) Get added in v0.5.0

func (this Address) Get() gonet.Addr

func (Address) IsEqualTo added in v0.5.0

func (this Address) IsEqualTo(other any) bool

func (Address) IsZero added in v0.5.0

func (this Address) IsZero() bool

func (Address) Listen added in v0.5.0

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

func (Address) MarshalText added in v0.5.0

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

func (*Address) Set added in v0.5.0

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

func (Address) String added in v0.5.0

func (this Address) String() string

func (*Address) UnmarshalText added in v0.5.0

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

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 NetAddresses

type NetAddresses []Address

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