util

package
v0.11.3 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Diff

func Diff(a, b []string) ([]string, []string)

Diff computes the diff of two string slices a and b, returns a-b and b-a

func IsClosedErr added in v0.11.1

func IsClosedErr(err error) bool

IsClosedErr is a helper function to check for "already closed" errors, which are usually harmless but still show up in logs, code adapted from https://stackoverflow.com/questions/44974984/how-to-check-a-net-conn-is-closed

func Member

func Member(list []string, a string) bool

check is list contains element a

func NewFileConn added in v0.11.3

func NewFileConn(file *os.File) net.Conn

NewFileConn returns a wrapper that shows an os.File as a net.Conn.

func Remove

func Remove(ss []string, e string) []string

Remove removes a given element from string slice

func Unique

func Unique(s []string) []string

Unique returns unique elements in a string slice

Types

type FileConn added in v0.11.3

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

func (*FileConn) Close added in v0.11.3

func (f *FileConn) Close() error

func (*FileConn) LocalAddr added in v0.11.3

func (f *FileConn) LocalAddr() net.Addr

func (*FileConn) Read added in v0.11.3

func (f *FileConn) Read(b []byte) (n int, err error)

func (*FileConn) RemoteAddr added in v0.11.3

func (f *FileConn) RemoteAddr() net.Addr

func (*FileConn) SetDeadline added in v0.11.3

func (f *FileConn) SetDeadline(t time.Time) error

func (*FileConn) SetReadDeadline added in v0.11.3

func (f *FileConn) SetReadDeadline(t time.Time) error

func (*FileConn) SetWriteDeadline added in v0.11.3

func (f *FileConn) SetWriteDeadline(t time.Time) error

func (*FileConn) Write added in v0.11.3

func (f *FileConn) Write(b []byte) (n int, err error)

type FileConnAddr added in v0.11.3

type FileConnAddr struct {
	File *os.File
}

func (*FileConnAddr) Network added in v0.11.3

func (s *FileConnAddr) Network() string

func (*FileConnAddr) String added in v0.11.3

func (s *FileConnAddr) String() string

Jump to

Keyboard shortcuts

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