Documentation ¶
Overview ¶
Package utils ...
Index ¶
- Constants
- Variables
- func BlendColors(c1, c2 color.RGBA) (ret color.RGBA)
- func CfbDecrypt(data []byte, key []byte) []byte
- func Clamp(a, b int) int
- func CleanupName(name string) string
- func DrawImgScaledPos(dst *image.RGBA, src *image.RGBA, bottomLeft image.Point, sizeScaled int)
- func DumpStruct(data interface{})
- func GetLocalIP() string
- func GetPacks(server *minecraft.Conn) (packs map[string]*resource.Pack, err error)
- func GetRealmsAPI() *realms.Client
- func GetTokenSource() oauth2.TokenSource
- func IPPrivate(ip net.IP) bool
- func Img2rgba(img *image.RGBA) []color.RGBA
- func InitDNS()
- func InitExtraDebug(ctx context.Context)
- func LERP(p1, p2, alpha float64) float64
- func MarginLines(lines []string) string
- func PacketLogger(header packet.Header, payload []byte, src, dst net.Addr)
- func RandSeededUUID(str string) string
- func RegisterCommand(sub Command)
- func ServerInput(ctx context.Context, server string) (string, string, error)
- func SetCurrentUI(ui UI)
- func SplitExt(filename string) (name, ext string)
- func UnpackZip(r io.ReaderAt, size int64, unpackFolder string)
- func UserInput(ctx context.Context, q string) (string, bool)
- func WriteManifest(manifest *resource.Manifest, fpath string) error
- func WriteReplayHeader(f io.Writer)
- func ZipFolder(filename, folder string) error
- type BaseUI
- type ClientConnectCallback
- type Command
- type ConnectCallback
- type CustomClientData
- type DNSServer
- type IngameCommand
- type InteractiveCLI
- type Pack
- type Packb
- type PacketCallback
- type PacketFunc
- type ProxyContext
- func (p *ProxyContext) AddCommand(cmd IngameCommand)
- func (p *ProxyContext) CommandHandlerPacketCB(pk packet.Packet, proxy *ProxyContext, toServer bool, _ time.Time) (packet.Packet, error)
- func (p *ProxyContext) LoadCustomUserData(path string) error
- func (p *ProxyContext) Run(ctx context.Context, serverAddress string) (err error)
- func (p *ProxyContext) SendMessage(text string)
- func (p *ProxyContext) SendPopup(text string)
- type RealmListCMD
- type UI
Constants ¶
View Source
const TokenFile = "token.json"
Variables ¶
View Source
var ( ExtraVerbose []string FLog io.Writer )
View Source
var ClientAddr net.Addr
View Source
var CmdName = "bedrocktool"
View Source
var DisconnectReason = "Connection lost"
View Source
var MakeGui = func() UI { return &InteractiveCLI{} }
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 Options struct { Debug bool Preload bool IsInteractive bool ExtraDebug bool EnableDNS bool PathCustomUserData string }
View Source
var PackFromBase = func(pack *resource.Pack) Pack { b := &Packb{pack} return b }
View Source
var PrivateIPNetworks = []net.IPNet{ { IP: net.ParseIP("10.0.0.0"), Mask: net.CIDRMask(8, 32), }, { IP: net.ParseIP("172.16.0.0"), Mask: net.CIDRMask(12, 32), }, { IP: net.ParseIP("192.168.0.0"), Mask: net.CIDRMask(16, 32), }, }
View Source
var RealmsEnv string
View Source
var Updater = &selfupdate.Updater{ CurrentVersion: Version, ApiURL: updateServer, BinURL: updateServer, Dir: "update/", CmdName: CmdName, Requester: &trequester{}, }
View Source
var ValidCMDs = make(map[string]Command, 0)
View Source
var Version string
Functions ¶
func CfbDecrypt ¶ added in v1.28.0
func CleanupName ¶
CleanupName cleans name so it can be used as a filename
func DrawImgScaledPos ¶ added in v1.28.0
DrawImgScaledPos draws src onto dst at bottomLeft, scaled to size
func DumpStruct ¶ added in v1.28.0
func DumpStruct(data interface{})
func GetRealmsAPI ¶ added in v1.28.0
func GetTokenSource ¶
func GetTokenSource() oauth2.TokenSource
func InitExtraDebug ¶ added in v1.28.0
func RandSeededUUID ¶ added in v1.28.0
func RegisterCommand ¶
func RegisterCommand(sub Command)
func SetCurrentUI ¶ added in v1.28.0
func SetCurrentUI(ui UI)
func WriteManifest ¶ added in v1.28.0
func WriteReplayHeader ¶ added in v1.28.0
Types ¶
type BaseUI ¶ added in v1.28.0
type BaseUI struct {
UI
}
type ClientConnectCallback ¶ added in v1.28.0
type ClientConnectCallback func(proxy *ProxyContext, hasClient bool)
type ConnectCallback ¶
type ConnectCallback func(proxy *ProxyContext, err error) bool
type CustomClientData ¶ added in v1.28.0
type IngameCommand ¶
type InteractiveCLI ¶ added in v1.28.0
type InteractiveCLI struct {
BaseUI
}
func (*InteractiveCLI) Init ¶ added in v1.28.0
func (c *InteractiveCLI) Init() bool
func (*InteractiveCLI) Start ¶ added in v1.28.0
func (c *InteractiveCLI) Start(ctx context.Context, cancel context.CancelFunc) error
type Packb ¶ added in v1.28.0
func (*Packb) CanDecrypt ¶ added in v1.28.0
type PacketCallback ¶
type ProxyContext ¶
type ProxyContext struct { Server *minecraft.Conn Client *minecraft.Conn Listener *minecraft.Listener AlwaysGetPacks bool WithClient bool IgnoreDisconnect bool CustomClientData *login.ClientData // called for every packet PacketFunc PacketFunc // called after client connected OnClientConnect ClientConnectCallback // called after game started ConnectCB ConnectCallback // called on every packet after login PacketCB PacketCallback // contains filtered or unexported fields }
func NewProxy ¶
func NewProxy() (*ProxyContext, error)
func (*ProxyContext) AddCommand ¶
func (p *ProxyContext) AddCommand(cmd IngameCommand)
func (*ProxyContext) CommandHandlerPacketCB ¶
func (p *ProxyContext) CommandHandlerPacketCB(pk packet.Packet, proxy *ProxyContext, toServer bool, _ time.Time) (packet.Packet, error)
func (*ProxyContext) LoadCustomUserData ¶ added in v1.28.0
func (p *ProxyContext) LoadCustomUserData(path string) error
func (*ProxyContext) Run ¶
func (p *ProxyContext) Run(ctx context.Context, serverAddress string) (err error)
func (*ProxyContext) SendMessage ¶
func (p *ProxyContext) SendMessage(text string)
func (*ProxyContext) SendPopup ¶
func (p *ProxyContext) SendPopup(text string)
type RealmListCMD ¶
type RealmListCMD struct{}
func (*RealmListCMD) Name ¶
func (*RealmListCMD) Name() string
func (*RealmListCMD) SetFlags ¶
func (c *RealmListCMD) SetFlags(f *flag.FlagSet)
func (*RealmListCMD) Synopsis ¶
func (*RealmListCMD) Synopsis() string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.