client

package
v0.0.0-...-cb17a1d Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2016 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	P2pBegin      = 0
	P2pShaking    = 1
	P2pOk         = 2
	P2pConnAcking = 1
	P2pConnFin    = 2
	P2pConnNormal = 3
)
View Source
const (
	UPADTE_TICK = 20 * time.Millisecond
	MASTER      = 0
	SLAVE       = 1
)

Variables

View Source
var (
	ErrMsgContinue = errors.New("message: continue")
)

Functions

func Abs

func Abs(x int) int

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.

func AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func ClientMain

func ClientMain()

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func RestoreAsset

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively

Types

type Client

type Client struct {
	killable.Killable
	// contains filtered or unexported fields
}

func (*Client) Calls

func (c *Client) Calls() chan *common.Future

func (*Client) Close

func (c *Client) Close()

func (*Client) Connect

func (c *Client) Connect() error

func (*Client) HookAdd

func (c *Client) HookAdd() chan *common.MsgHook

func (*Client) HookDel

func (c *Client) HookDel() chan int

func (*Client) Regist

func (c *Client) Regist() error

func (*Client) RemoveClient

func (c *Client) RemoveClient(clientId int)

func (*Client) Run

func (c *Client) Run() error

func (*Client) RunFor

func (c *Client) RunFor(tick *time.Ticker) error

type ClientConfig

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

type ConfigJson

type ConfigJson struct {
	Listen   []string `json:"listen"`
	Server   string   `json:"server"`
	Port     int      `json:"port"`
	User     string   `json:"user"`
	Password string   `json:"password"`
}

type LocalConn

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

type LocalListen

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

func (*LocalListen) Run

func (l *LocalListen) Run(c *Client) error

type P2pClient

type P2pClient struct {
	killable.Killable
	// contains filtered or unexported fields
}

func (*P2pClient) Calls

func (p2pc *P2pClient) Calls() chan *common.Future

func (*P2pClient) Close

func (p2pc *P2pClient) Close()

func (*P2pClient) DoDying

func (p2pc *P2pClient) DoDying(c *Client)

func (*P2pClient) Init

func (p2pc *P2pClient) Init(c *Client) error

func (*P2pClient) NewConn

func (p2pc *P2pClient) NewConn(conn net.Conn, port int, tPort int, isProxy bool, c *Client)

func (*P2pClient) RemoveConn

func (p2pc *P2pClient) RemoveConn(p *P2pConn)

func (*P2pClient) RunC

func (p2pc *P2pClient) RunC(c *Client) error

func (*P2pClient) RunCFor

func (p2pc *P2pClient) RunCFor(updateChan *time.Ticker, pingTick *time.Ticker) error

type P2pConn

type P2pConn struct {
	killable.Killable
	// contains filtered or unexported fields
}

func (*P2pConn) Close

func (p *P2pConn) Close()

func (*P2pConn) GoDying

func (p *P2pConn) GoDying(p2pc *P2pClient, c *Client)

func (*P2pConn) Init

func (p *P2pConn) Init(p2pc *P2pClient, c *Client) error

func (*P2pConn) Run

func (p *P2pConn) Run(p2pc *P2pClient, c *Client) error

func (*P2pConn) RunFor

func (p *P2pConn) RunFor(p2pc *P2pClient, c *Client, updateChan *time.Ticker) error

type StartInfo

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

Jump to

Keyboard shortcuts

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