utils

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: MIT Imports: 21 Imported by: 3

Documentation

Index

Constants

View Source
const (
	IsChildEnv     = "XTRAY_IS_CHILD_PROCESS"
	IsChildProcess = "XTRAY_IS_CHILD_PROCESS=true"
)

Variables

This section is empty.

Functions

func DaemonizeInit

func DaemonizeInit()

func DecodeBase64

func DecodeBase64(str string) (res string)

func GetHomeDir

func GetHomeDir() (homeDir string)

func NormalizeSSR

func NormalizeSSR(s string) (r string)

func StringToReader

func StringToReader(str string) io.Reader

Types

type KoanfJSON

type KoanfJSON struct{}

func NewJsonParser

func NewJsonParser() *KoanfJSON

func (*KoanfJSON) Marshal

func (p *KoanfJSON) Marshal(o map[string]interface{}) ([]byte, error)

Marshal marshals the given config map to JSON bytes.

func (*KoanfJSON) Unmarshal

func (p *KoanfJSON) Unmarshal(b []byte) (map[string]interface{}, error)

Unmarshal parses the given JSON bytes.

type Koanfer

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

func NewKoanfer

func NewKoanfer(path string) (r *Koanfer)

func (*Koanfer) Load

func (that *Koanfer) Load(obj interface{})

func (*Koanfer) Save

func (that *Koanfer) Save(obj interface{})

type UClient

type UClient struct {
	*USocket
	Client *http.Client
	// contains filtered or unexported fields
}

func NewUClient

func NewUClient(name string) (uc *UClient)

func (*UClient) GetResp

func (that *UClient) GetResp(route string, params map[string]string) (string, error)

type UServer

type UServer struct {
	*USocket
	Engine *gin.Engine
}

func NewUServer

func NewUServer(name string) (us *UServer)

func (*UServer) AddHandler

func (that *UServer) AddHandler(route string, handler func(c *gin.Context))

func (*UServer) Start

func (that *UServer) Start() (err error)

type USocket

type USocket struct {
	Name string
	Path string
}

func (*USocket) CheckSock

func (that *USocket) CheckSock()

func (*USocket) SetSock

func (that *USocket) SetSock(name string)

Jump to

Keyboard shortcuts

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