utils

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2022 License: GPL-3.0 Imports: 27 Imported by: 1

Documentation

Index

Constants

View Source
const TOKEN_FILE = "token.json"

Variables

View Source
var APIClient *apiClient
View Source
var ExtraVerbose []string
View Source
var G_debug bool
View Source
var MutedPackets = []string{
	"packet.UpdateBlock",
	"packet.MoveActorAbsolute",
	"packet.SetActorMotion",
	"packet.SetTime",
	"packet.RemoveActor",
	"packet.AddActor",
	"packet.UpdateAttributes",
	"packet.Interact",
	"packet.LevelEvent",
	"packet.SetActorData",
	"packet.MoveActorDelta",
	"packet.MovePlayer",
	"packet.BlockActorData",
	"packet.PlayerAuthInput",
	"packet.LevelChunk",
	"packet.LevelSoundEvent",
	"packet.ActorEvent",
	"packet.NetworkChunkPublisherUpdate",
	"packet.UpdateSubChunkBlocks",
	"packet.SubChunk",
	"packet.SubChunkRequest",
	"packet.Animate",
	"packet.NetworkStackLatency",
	"packet.InventoryTransaction",
	"packet.PlaySound",
}
View Source
var Pool = packet.NewPool()

Functions

func CleanupName

func CleanupName(name string) string

cleans name so it can be used as a filename

func ConnectServer

func ConnectServer(ctx context.Context, address, clientName string, packetFunc PacketFunc) (serverConn *minecraft.Conn, err error)

func FindAllIps

func FindAllIps(Address string) (ret []string, err error)

func GetChain

func GetChain(name string) (key *ecdsa.PrivateKey, chainData string, err error)

GetChain gets a chain for this user

func GetTokenSource

func GetTokenSource(name string) oauth2.TokenSource

GetTokenSource returns the token source for this username

func InitAPIClient

func InitAPIClient(APIServer, APIKey string, metrics Metrics) error

InitAPIClient creates the api client

func PacketLogger

func PacketLogger(header packet.Header, payload []byte, src, dst, local_addr net.Addr)

Types

type APIRoutes added in v0.1.3

type APIRoutes struct {
	AMQPUrl           string
	PrometheusPushURL string
	PrometheusAuth    string
}

type DBNameListItem added in v0.1.3

type DBNameListItem struct {
	Time primitive.Timestamp `bson:"time"`
	Name string              `bson:"name"`
}

type DBPlayerInfo added in v0.1.3

type DBPlayerInfo struct {
	Id   primitive.ObjectID `bson:"_id,omitempty"`
	Xuid string             `bson:"xuid"`

	ObservedNamesIngame []DBNameListItem `bson:"observed_names_ingame"`
	ObservedNamesXbox   []DBNameListItem `bson:"observed_names_xbox"`
	ObservedSkins       []DBSkinListItem `bson:"observed_skins"`
}

type DBSkinListItem added in v0.1.3

type DBSkinListItem struct {
	Time primitive.Timestamp `bson:"time"`

	SkinDataHash string `bson:"skin_data_hash"`
	SkinId       string `bson:"skin_id"`

	CapeDataHash string `bson:"cape_data_hash"`
	CapeId       string `bson:"cape_id"`

	SkinResourceHash          string `bson:"skin_resource_hash"`
	GeometryHash              string `bson:"geometry_hash"`
	GeometryDataEngineVersion string `bson:"geometry_data_version"`

	FullId      string `bson:"full_id"`
	PlayFabId   string `bson:"playfab_id"`
	PremiumSkin bool   `bson:"is_premium_skin"`
	PersonaSkin bool   `bson:"is_persona_skin"`
	SkinColour  string `bson:"skin_colour"`
	ArmSize     string `bson:"arm_size"`
}

type JsonSkinData added in v0.1.2

type JsonSkinData struct {
	SkinID                          string
	PlayFabID                       string
	SkinResourcePatch               string
	SkinImageWidth, SkinImageHeight uint32
	SkinData                        string
	Animations                      []Skin_anim
	CapeImageWidth, CapeImageHeight uint32
	CapeData                        string
	SkinGeometry                    string
	AnimationData                   string
	GeometryDataEngineVersion       string
	PremiumSkin                     bool
	PersonaSkin                     bool
	PersonaCapeOnClassicSkin        bool
	PrimaryUser                     bool
	CapeID                          string
	FullID                          string
	SkinColour                      string
	ArmSize                         string
	PersonaPieces                   []protocol.PersonaPiece
	PieceTintColours                []protocol.PersonaPieceTintColour
	Trusted                         bool
}

func (*JsonSkinData) ToSkin added in v0.1.2

func (j *JsonSkinData) ToSkin() *Skin

type MCChain

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

type MQ added in v0.1.2

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

func NewQueue added in v0.1.2

func NewQueue(uri string, want_pubsub bool) *MQ

func (*MQ) Close added in v0.1.2

func (q *MQ) Close()

func (*MQ) PubSubSkin added in v0.1.2

func (q *MQ) PubSubSkin(ctx context.Context, username, xuid, skin *DBSkinListItem) error

PubSubSkin puts skin to the pubsub

func (*MQ) PublishSkin added in v0.1.2

func (q *MQ) PublishSkin(ctx context.Context, skin *QueuedSkin) error

PublishSkin publishes a skin to the skin queue

func (*MQ) ReceiveSkins added in v0.1.2

func (q *MQ) ReceiveSkins() chan *QueuedSkin

ReceiveSkins receives skins to a channel

type Metrics

type Metrics interface {
	// Start starts the metric pusher
	Start(url, user, password string) error
	// deletes from pusher
	Delete()
}

type PacketFunc

type PacketFunc func(header packet.Header, payload []byte, src, dst net.Addr)

type Queue added in v0.1.2

type Queue interface {
	Start(url string) error
}

type QueuedSkin added in v0.1.2

type QueuedSkin struct {
	Username      string
	Xuid          string
	Skin          *JsonSkinData
	ServerAddress string
	Time          int64
}

type Skin

type Skin struct {
	protocol.Skin
}

func (*Skin) Json

func (s *Skin) Json() *JsonSkinData

type Skin_anim added in v0.1.2

type Skin_anim struct {
	ImageWidth, ImageHeight uint32
	ImageData               string
	AnimationType           uint32
	FrameCount              float32
	ExpressionType          uint32
}

Jump to

Keyboard shortcuts

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