cs

package
v0.0.0-...-70b9ccc Latest Latest
Warning

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

Go to latest
Published: May 28, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type C

type C interface {
	Open() (P, error) // Open Conn
	Close()
}

C wrapper Client

func MustC

func MustC(m C, e error) C

MustC handle error

type CS

type CS interface {
	S() (S, error) // Listen
	C() (C, error) // Client
}

CS Builder

func KCP

func KCP(addr string, key []byte) (CS, error)

KCP Protocol

Need key, like: key := pbkdf2.Key([]byte("pass"), []byte("salt"), 1024, 32, sha1.New)

func MustCS

func MustCS(m CS, e error) CS

MustCS handle error

func SMUX

func SMUX(p P) CS

SMUX wrapper https://github.com/xtaci/smux

func TCP

func TCP(address string) (CS, error)

TCP Protocol

type P

type P interface {
	Read([]byte) (int, error)  // Read from Conn
	Write([]byte) (int, error) // Write to Conn
	Close()                    // Close Conn

	Conn() net.Conn // Get Conn
}

P wrapper pipe

func MustP

func MustP(m P, e error) P

MustP handle error

type S

type S interface {
	Accept() (P, error) // Open Conn
	Close()             // Close Listen
}

S wrapper Server

func MustS

func MustS(m S, e error) S

MustS handle error

Jump to

Keyboard shortcuts

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