MCPcopy Create free account
hub / github.com/PasarGuard/node / NewXRayCore

Function NewXRayCore

backend/xray/core.go:46–68  ·  view source on GitHub ↗
(executablePath, assetsPath, configPath string, logBufferSize, startupLogTailSize int)

Source from the content-addressed store, hash-verified

44}
45
46func NewXRayCore(executablePath, assetsPath, configPath string, logBufferSize, startupLogTailSize int) (*Core, error) {
47 if startupLogTailSize <= 0 {
48 startupLogTailSize = 200
49 }
50
51 core := &Core{
52 executablePath: executablePath,
53 assetsPath: assetsPath,
54 configPath: configPath,
55 logsChan: make(chan string, logBufferSize),
56 logPhase: logPhaseRuntime,
57 startupLogSize: startupLogTailSize,
58 runtimeLogs: newStartupLogRing(10),
59 }
60
61 version, err := core.refreshVersion()
62 if err != nil {
63 return nil, err
64 }
65 core.version = version
66
67 return core, nil
68}
69
70func (c *Core) GenerateConfigFile(config []byte) error {
71 var prettyJSON bytes.Buffer

Callers 1

NewFunction · 0.85

Calls 2

refreshVersionMethod · 0.95
newStartupLogRingFunction · 0.85

Tested by

no test coverage detected