client

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2023 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultLocalPort  = 10800
	DefaultServerHost = "thlink.inuyasha.love:4646"
	DefaultTunnelType = "tcp"
)
View Source
const (
	HELLO_123             type123pkg = iota + 1 // 0x01
	PUNCH_123                                   // 0x02
	OLLEH_123                                   // 0x03
	CHAIN_123                                   // 0x04
	INIT_REQUEST_123                            // 0x05
	INIT_SUCCESS_123                            // 0x06
	INIT_ERROR_123                              // 0x07
	REDIRECT_123                                // 0x08
	QUIT_123              type123pkg = iota + 3 // 0x0b
	HOST_GAME_123         type123pkg = iota + 4 // 0x0d
	CLIENT_GAME_123                             // 0x0e
	SOKUROLL_TIME         type123pkg = iota + 5 // 0x10
	SOKUROLL_TIME_ACK                           // 0x11
	SOKUROLL_STATE                              // 0x12
	SOKUROLL_SETTINGS                           // 0x13
	SOKUROLL_SETTINGS_ACK                       // 0x14
)
View Source
const (
	GAME_LOADED_123         data123pkg = iota + 1 // 0x01
	GAME_LOADED_ACK_123                           // 0x02
	GAME_INPUT_123                                // 0x03
	GAME_MATCH_123                                // 0x04
	GAME_MATCH_ACK_123                            // 0x05
	GAME_MATCH_REQUEST_123  data123pkg = iota + 3 // 0x08
	GAME_REPLAY_123                               // 0x09
	GAME_REPLAY_REQUEST_123 data123pkg = iota + 4 // 0x0b
)
View Source
const (
	NOSPECTATE_123             spectate123type = 0x00
	SPECTATE_123               spectate123type = 0x10
	SPECTATE_FOR_SPECTATOR_123 spectate123type = 0x11
)
View Source
const (
	INIT_123 status123req = iota
	SEND_123
	SENT0_123
	SENT1_123
	SEND_AGAIN_123
)
View Source
const (
	CLIENT_T_ACK_155 type155pkg = iota     // 0x00
	HOST_T_ACK_155                         // 0x01
	INIT_ACK_155     type155pkg = iota + 2 // 0x04
	HOST_T_155                             // 0x05
	CLIENT_T_155                           // 0x06
	PUNCH_155                              // 0x07
	INIT_155                               // 0x08
	INIT_REQUEST_155                       // 0x09
	INIT_SUCCESS_155 type155pkg = iota + 3 // 0x0b
	INIT_ERROR_155                         // 0x0c
	HOST_QUIT_155    type155pkg = iota + 5 // 0x0f
	CLIENT_QUIT_155                        // 0x10
	HOST_GAME_155    type155pkg = iota + 6 // 0x12
	CLIENT_GAME_155                        // 0x13
)
View Source
const (
	GAME_SELECT_155         data155pkg = iota + 4 // 0x04
	GAME_INPUT_155          data155pkg = iota + 5 // 0x06
	GAME_REPLAY_REQUEST_155 data155pkg = iota + 7 // 0x09
	GAME_REPLAY_MATCH_155                         // 0x0a
	GAME_REPLAY_DATA_155                          // 0x0b
	GAME_REPLAY_END_155                           // 0x0c
)
View Source
const (
	MATCH_WAIT_155   match155status = iota // no game start
	MATCH_ACCEPT_155                       // peer connected
	MATCH_SPECT_ACK_155
	MATCH_SPECT_INIT_155
	MATCH_SPECT_SUCCESS_155 // fetching replay data
	MATCH_SPECT_ERROR_155   // cannot get replay data
)

Variables

This section is empty.

Functions

func NetBrokerDelay added in v0.0.8

func NetBrokerDelay(server string) (map[string]int, error)

NetBrokerDelay broker delay nanoseconds in network

Types

type Client added in v0.0.7

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

func New added in v0.0.7

func New(localPort int, serverHost string, tunnelType string) (*Client, error)

New set up new client

func NewWithDefault added in v0.0.7

func NewWithDefault() *Client

NewWithDefault set up default client

func (*Client) BrokerVersion added in v0.0.9

func (c *Client) BrokerVersion() (byte, string)

BrokerVersion get broker tunnel version

func (*Client) Close added in v0.0.7

func (c *Client) Close()

Close stop this tunnel

func (*Client) Connect added in v0.0.7

func (c *Client) Connect() error

Connect ask new tunnel and connect

func (*Client) LocalPort added in v0.0.7

func (c *Client) LocalPort() int

LocalPort get client config local port

func (*Client) PeerHost added in v0.0.7

func (c *Client) PeerHost() string

PeerHost get client peer host

func (*Client) Ping added in v0.0.7

func (c *Client) Ping() time.Duration

Ping get client to broker delay

func (*Client) Serve added in v0.0.7

func (c *Client) Serve(readFunc, writeFunc utils.PluginCallback, plRoutine utils.PluginGoroutine, plQuit utils.PluginSetQuitFlag) error

func (*Client) ServerHost added in v0.0.7

func (c *Client) ServerHost() string

ServerHost get client config server host

func (*Client) Serving added in v0.0.7

func (c *Client) Serving() bool

func (*Client) TunnelDelay added in v0.0.7

func (c *Client) TunnelDelay() time.Duration

TunnelDelay ping delay between client and broker

func (*Client) TunnelStatus added in v0.0.11

func (c *Client) TunnelStatus() utils.TunnelStatus

TunnelStatus get tunnel status

func (*Client) TunnelType added in v0.0.7

func (c *Client) TunnelType() string

TunnelType get client config tunnel type tcp/quic

func (*Client) Version added in v0.0.9

func (c *Client) Version() (byte, string, string)

Version get self tunnel version

type Hisoutensoku added in v0.0.9

type Hisoutensoku struct {
	PeerStatus Status123peer // current peer status
	// contains filtered or unexported fields
}

func NewHisoutensoku added in v0.0.9

func NewHisoutensoku() *Hisoutensoku

NewHisoutensoku new Hisoutensoku spectating server

func (*Hisoutensoku) GetReplayDelay added in v0.0.10

func (h *Hisoutensoku) GetReplayDelay() time.Duration

func (*Hisoutensoku) GetSpectatorCount added in v0.0.10

func (h *Hisoutensoku) GetSpectatorCount() int

func (*Hisoutensoku) GoroutineFunc added in v0.0.9

func (h *Hisoutensoku) GoroutineFunc(tunnelConn interface{}, _ *net.UDPConn)

func (*Hisoutensoku) ReadFunc added in v0.0.9

func (h *Hisoutensoku) ReadFunc(orig []byte) (bool, []byte)

ReadFunc from game client to host orig: original data leads with 1 byte of client id

func (*Hisoutensoku) SetQuitFlag added in v0.0.11

func (h *Hisoutensoku) SetQuitFlag()

func (*Hisoutensoku) WriteFunc added in v0.0.9

func (h *Hisoutensoku) WriteFunc(orig []byte) (bool, []byte)

WriteFunc from game host to client orig: original data leads with 1 byte of client id

type Hyouibana added in v0.0.11

type Hyouibana struct {
	MatchStatus match155status // current match status
	// contains filtered or unexported fields
}

func NewHyouibana added in v0.0.11

func NewHyouibana() *Hyouibana

NewHyouibana new Hyouibana spectating server

func (*Hyouibana) GetSpectatorCount added in v0.0.11

func (h *Hyouibana) GetSpectatorCount() int

func (*Hyouibana) GoroutineFunc added in v0.0.11

func (h *Hyouibana) GoroutineFunc(tunnelConn interface{}, conn *net.UDPConn)

func (*Hyouibana) ReadFunc added in v0.0.11

func (h *Hyouibana) ReadFunc(orig []byte) (bool, []byte)

ReadFunc from game client to host orig: original data leads with 1 byte of client id

func (*Hyouibana) SetQuitFlag added in v0.0.11

func (h *Hyouibana) SetQuitFlag()

func (*Hyouibana) WriteFunc added in v0.0.11

func (h *Hyouibana) WriteFunc(orig []byte) (bool, []byte)

WriteFunc from game host to client orig: original data leads with 1 byte of client id

type Status123peer added in v0.0.9

type Status123peer byte
const (
	INACTIVE_123 Status123peer = iota
	SUCCESS_123
	BATTLE_123
	BATTLE_WAIT_ANOTHER_123
)

Jump to

Keyboard shortcuts

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