ffxiv

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CompressionNone  = CompressionType(0)
	CompressionZlib  = CompressionType(1)
	CompressionOodle = CompressionType(2)
)
View Source
const (
	RegionGlobal = Region("Global")
	RegionChina  = Region("CN")
	RegionKorea  = Region("KR")
)
View Source
const (
	ServerZoneIpcType  = IpcType("ServerZoneIpcType")
	ClientZoneIpcType  = IpcType("ClientZoneIpcType")
	ServerLobbyIpcType = IpcType("ServerLobbyIpcType")
	ClientLobbyIpcType = IpcType("ClientLobbyIpcType")
	ServerChatIpcType  = IpcType("ServerChatIpcType")
	ClientChatIpcType  = IpcType("ClientChatIpcType")
)
View Source
const (
	SegmentIpc             = SegmentType(3)
	SegmentClientKeepAlive = SegmentType(7)
	SegmentServerKeepAlive = SegmentType(8)
)

Variables

View Source
var (
	// Magic bytes indicating that a Bundle contains IPC segments.
	IpcMagicBytes = []byte("\x52\x52\xa0\x41\xff\x5d\x46\xe2\x7f\x2a\x64\x4d\x7b\x99\xc4\x75")

	// Magic bytes indicating that a Bundle contains keep-alive segments.
	KeepAliveMagicBytes = []byte("\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00")
)
View Source
var (
	ErrBadMagicBytes  = errors.New("ffxiv: bad magic bytes")
	ErrBadCompression = errors.New("ffxiv: bad compression type")
	ErrBadSegmentType = errors.New("ffxiv: bad segment type")
	ErrNotEnoughData  = errors.New("ffxiv: not enough data")
)
View Source
var DataCenterCIDRs = [...]string{

	"80.239.145.79/32",
	"80.239.145.80/29",
	"80.239.145.88/31",

	"80.239.145.91/32",
	"80.239.145.92/30",
	"80.239.145.96/30",
	"80.239.145.100/31",

	"124.150.157.23/32",
	"124.150.157.24/29",
	"124.150.157.32/32",

	"124.150.157.38/31",
	"124.150.157.40/29",

	"124.150.157.49/32",
	"124.150.157.50/31",
	"124.150.157.52/30",
	"124.150.157.56/31",
	"124.150.157.58/32",

	"153.254.80.75/32",
	"153.254.80.76/30",
	"153.254.80.80/31",
	"153.254.80.82/32",

	"202.67.52.205/32",
	"202.67.52.206/31",
	"202.67.52.208/30",
	"202.67.52.212/31",
	"202.67.52.214/32",

	"204.2.229.84/32",
	"204.2.229.86/32",
	"204.2.229.88/30",
	"204.2.229.92/32",

	"204.2.229.95/32",
	"204.2.229.96/30",
	"204.2.229.101/32",
	"204.2.229.102/31",

	"204.2.229.106/31",
	"204.2.229.108/32",
	"204.2.229.110/31",
	"204.2.229.112/31",
	"204.2.229.114/32",
}

DataCenterCIDRs is an array of all theorized public FINAL FANTASY XIV data center IP networks, in string CIDR notation.

Based on data provided by https://is.xivup.com/adv.

View Source
var DataCenterNets = func() []net.IPNet {
	nets := make([]net.IPNet, len(DataCenterCIDRs))

	for i, s := range DataCenterCIDRs {
		_, net, err := net.ParseCIDR(s)
		if err != nil {
			panic(err)
		}
		nets[i] = *net
	}

	return nets
}()

DataCenterNets is a list of all theorized public FINAL FANTASY XIV data center IP networks, as IPNets.

View Source
var ErrUnknownRegion = errors.New("ffxiv: unknown region")

Functions

func IsFinalFantasyIP

func IsFinalFantasyIP(ip net.IP) bool

Returns whether ip is a known FINAL FANTASY XIV address.

func PeekBundleLength

func PeekBundleLength(data []byte) int

Types

type Bundle

type Bundle struct {
	// Magic bytes header - all IPC bundles share the same magic bytes
	// and all keep-alive bundles have a magic string of all null bytes.
	Magic [16]byte `json:"-"`

	// The number of milliseconds since the Unix epoch time.
	Epoch uint64 `json:"epoch"`

	// The total length of the bundle, in bytes (including the header).
	Length uint32 `json:"length"`

	UncompressedLength uint32 `json:"uncompressedLength"`

	// The connection type. Usually 0.
	ConnectionType uint16 `json:"connectionType"`

	// The encoding type of the bundle payload.
	Encoding EncodingType `json:"-"`

	// The compression type of the bundle payload.
	Compression CompressionType `json:"-"`

	Segments []Segment `json:"segments"`
}

func (*Bundle) IsCompressed

func (b *Bundle) IsCompressed() bool

func (*Bundle) Time

func (b *Bundle) Time() time.Time

func (*Bundle) UnmarshalBinary

func (b *Bundle) UnmarshalBinary(data []byte) error

type CompressionType

type CompressionType uint8

type EncodingType

type EncodingType uint8

type Ipc

type Ipc struct {
	Magic    uint16 `json:"-"`
	Type     uint16 `json:"type"`
	ServerID uint16 `json:"serverId"`
	Epoch    uint32 `json:"epoch"`

	Data []byte `json:"data"`
}

func (*Ipc) UnmarshalBinary

func (i *Ipc) UnmarshalBinary(data []byte) error

type IpcType

type IpcType string

type KeepAlive

type KeepAlive struct {
	ID    uint32 `json:"id"`
	Epoch uint32 `json:"epoch"`
}

func (*KeepAlive) UnmarshalBinary

func (k *KeepAlive) UnmarshalBinary(data []byte) error

type OpcodeTable

type OpcodeTable struct {
	Version string
	Lists   map[IpcType]opcodeMapping
	Region  Region
}

func GetOpcodes

func GetOpcodes(region Region) (OpcodeTable, error)

func (*OpcodeTable) GetOpcodeName

func (t *OpcodeTable) GetOpcodeName(ipcType IpcType, opcode int) string

type Region

type Region string

type Segment

type Segment struct {
	// The total length of the segment, in bytes (including the header).
	Length uint32 `json:"-"`

	// The ID of the actor that sent the segment.
	Source uint32 `json:"source"`

	// The ID of the actor that received the segment.
	Target uint32 `json:"target"`

	// The segment type. Usually SegmentIpc.
	Type SegmentType `json:"type"`

	Payload interface{} `json:"payload"`
}

func (*Segment) UnmarshalBinary

func (s *Segment) UnmarshalBinary(data []byte) error

type SegmentType

type SegmentType uint16

func (SegmentType) String

func (s SegmentType) String() string

Jump to

Keyboard shortcuts

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