Help us shape the future of Go! Take the 2026 Go Developer Survey

highway

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2024 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const BlockSize = 256 * 1024

Variables

This section is empty.

Functions

func Frame

func Frame(head []byte, body []byte) net.Buffers

Frame 包格式

  • STX: 0x28(40)
  • head length
  • body length
  • head data
  • body data
  • ETX: 0x29(41)

节省内存, 可被go runtime优化为writev操作

Types

type Addr

type Addr struct {
	IP   uint32
	Port int
}

func (Addr) AsNetIP

func (a Addr) AsNetIP() net.IP

func (Addr) String

func (a Addr) String() string

type Session

type Session struct {
	Uin        *uint32
	AppID      uint32
	SubAppID   uint32
	SigSession []byte
	SessionKey []byte

	SsoAddr []Addr
	// contains filtered or unexported fields
}

func (*Session) AddrLength

func (s *Session) AddrLength() int

func (*Session) AppendAddr

func (s *Session) AppendAddr(ip, port uint32)

func (*Session) NextSeq

func (s *Session) NextSeq() uint32

func (*Session) Upload

func (s *Session) Upload(trans *Transaction) ([]byte, error)

type Transaction

type Transaction struct {
	CommandID uint32
	Body      io.Reader
	Sum       []byte // md5 sum of body
	Size      uint64 // body size
	Ticket    []byte
	LoginSig  []byte
	Ext       []byte
	Encrypt   bool
}

func (*Transaction) Build

func (trans *Transaction) Build(s *Session, offset uint64, length uint32, md5hash []byte) *highway.ReqDataHighwayHead

Jump to

Keyboard shortcuts

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