tools

package
v0.0.0-...-5c9b693 Latest Latest
Warning

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

Go to latest
Published: May 17, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ZT_C25519_PUBLIC_KEY_LEN = 64
	ZT_C25519_SIGNATURE_LEN  = 96
	ZT_WORLD_MAX_ROOTS       = 4
	ZT_WORLD_ID_EARTH        = 149604618
	ZT_INETADDRESS_IPV4      = 0x04
	ZT_INETADDRESS_IPV6      = 0x06
)

Variables

This section is empty.

Functions

func CheckIsCurrentPlanet

func CheckIsCurrentPlanet(base64Planet, existingHashStr string) bool

func GetCurrentPlanetHashFromOS

func GetCurrentPlanetHashFromOS() string

func IsRunAsRoot

func IsRunAsRoot() bool

func ReplacePlanetAndJoinNetwork

func ReplacePlanetAndJoinNetwork(base64Planet string, networkID string, callback func(int, string)) error

ReplacePlanetAndJoinNetwork 替换 planet 文件并加入指定网络

Types

type Identity

type Identity struct {
	Address   [5]byte
	PublicKey [64]byte
}

func ParseIdentity

func ParseIdentity(buf *bytes.Reader) (*Identity, error)

func (*Identity) String

func (i *Identity) String() string

type InetAddress

type InetAddress struct {
	Family uint8
	IP     net.IP
	Port   uint16
}

func ParseInetAddress

func ParseInetAddress(buf *bytes.Reader) (*InetAddress, error)

func (*InetAddress) String

func (ia *InetAddress) String() string

type Root

type Root struct {
	Identity        Identity
	StableEndpoints []InetAddress
}

func ParseRoot

func ParseRoot(buf *bytes.Reader) (*Root, error)

type World

type World struct {
	Type                  uint8
	ID                    uint64
	Timestamp             uint64
	UpdatesMustBeSignedBy [ZT_C25519_PUBLIC_KEY_LEN]byte
	Signature             [ZT_C25519_SIGNATURE_LEN]byte
	Roots                 []Root
	RawData               []byte
}

func ParsePlanetBase64

func ParsePlanetBase64(b64encText string) (*World, error)

func ParsePlanetFile

func ParsePlanetFile(filename string) (*World, error)

func ParseWorld

func ParseWorld(data []byte) (*World, error)

func (World) ToBase64

func (w World) ToBase64() string

Jump to

Keyboard shortcuts

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