utils

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

View Source
const (
	ProtoTCP       = "tcp"
	ProtoUDP       = "udp"
	ProtoWebsocket = "ws"
)

Variables

This section is empty.

Functions

func CompleteAddress

func CompleteAddress(address, proto string) (string, error)

CompleteAddress

@Description: 补完地址
@param address 原始地址,格式如 `192.168.0.10:9851` 或 `tcp://192.168.0.10:9851`
@param proto  协议,如 `tcp`、`udp`
@return string 地址格式如 `tcp://192.168.0.10:9851`
@return error

func GetAddress added in v0.0.3

func GetAddress(protoAddr string) (proto string, address string, err error)

GetAddress

@Description: 分拆协议和地址
@param protoAddr 格式如:`tcp://192.168.0.10:9851`
@return proto
@return address
@return err

Types

type BytesReader added in v0.0.12

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

func NewBytesReader added in v0.0.12

func NewBytesReader(data []byte) *BytesReader

func (*BytesReader) Discard added in v0.0.12

func (r *BytesReader) Discard(n int) (discarded int, err error)

func (*BytesReader) InboundBuffered added in v0.0.12

func (r *BytesReader) InboundBuffered() int

func (*BytesReader) Next added in v0.0.12

func (r *BytesReader) Next(n int) (buf []byte, err error)

func (*BytesReader) Peek added in v0.0.12

func (r *BytesReader) Peek(n int) (buf []byte, err error)

func (*BytesReader) Read added in v0.0.12

func (r *BytesReader) Read(p []byte) (n int, err error)

func (*BytesReader) WriteTo added in v0.0.12

func (r *BytesReader) WriteTo(w io.Writer) (n int64, err error)

Jump to

Keyboard shortcuts

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