Documentation
¶
Overview ¶
SPDX-License-Identifier: GPL-3.0-or-later
SPDX-License-Identifier: GPL-3.0-or-later
defaults.go +build !debug
SPDX-License-Identifier: GPL-3.0-or-later
SPDX-License-Identifier: GPL-3.0-or-later
Index ¶
- Constants
- Variables
- func GetFormatByExtension(filename string) string
- type V2utils
- func (v2 V2utils) Apply_URL(url string) error
- func (v2 *V2utils) Apply_template(file_path string) error
- func (v2 *V2utils) Apply_template_byio(rio io.Reader) error
- func (v2 *V2utils) Apply_template_bystr(template string) error
- func (v2 V2utils) CFG_Out(w io.Writer, indention bool) error
- func (v2 V2utils) Convert_conf2url() (string, error)
- func (v2 V2utils) CustomDial(ctx context.Context, network, addr string) (xnet.Conn, error)
- func (v2 *V2utils) Exec_Xray() error
- func (v2 *V2utils) HasTemplate() bool
- func (v2 *V2utils) Init_Outbound_byURL(url string) error
- func (v2 V2utils) Kill_Xray()
- func (v2 *V2utils) Run_Xray() error
- func (v2 *V2utils) Test_CFG(path string) (result bool, duration int64)
- func (v2 *V2utils) Test_URL(url string) (result bool, duration int64)
- func (v2 *V2utils) UnsetTemplate()
Constants ¶
View Source
const ( // Default template for run command DEF_Run_Template = `` /* 266-byte string literal not displayed */ // Default template for test command DEF_Test_Template = ` { "log": {"loglevel": "none"} }` )
View Source
const ( // Default test endpoint Test_Endpoint_0 = "http://www.google.com" // IP address API test endpoints Test_Endpoint_1 = "http://api4.ipify.org" Test_Endpoint_2 = "http://v4.api.ipinfo.io/ip" Test_Endpoint_3 = "http://check-host.net/ip" Test_Endpoint_4 = "http://ipv4.icanhazip.com" )
Variables ¶
View Source
var ( // Timeout to fail a test TestTimeout time.Duration = 10 * time.Second // Maximum number of endpoints to test TestCount int = 3 TestEndpoints = []string{ Test_Endpoint_0, Test_Endpoint_1, Test_Endpoint_2, Test_Endpoint_3, Test_Endpoint_4, } )
Functions ¶
func GetFormatByExtension ¶
Types ¶
type V2utils ¶
type V2utils struct {
CFG *conf.Config
Xray_instance *core.Instance // xray-core client instance
// contains filtered or unexported fields
}
func (*V2utils) Apply_template ¶
Applies the template v2.template_path to v2.CFG
func (*V2utils) Apply_template_bystr ¶
func (V2utils) Convert_conf2url ¶
URL generator
func (V2utils) CustomDial ¶
This will utilize the xray-core Dial function (DialContext compatible)
func (*V2utils) HasTemplate ¶
func (*V2utils) Init_Outbound_byURL ¶
Initializes @v2.CFG.OutboundConfig by the provided proxy URL @url
func (V2utils) Kill_Xray ¶
func (v2 V2utils) Kill_Xray()
Do NOT use v2.Xray_instance after this call
func (*V2utils) Test_URL ¶
Tests a minimal config generated by DEF_Test_Template It will not create any local listening proxy, instead it passes a simple HTTP request through the running xray-core instance @v2.Xray_instance.
func (*V2utils) UnsetTemplate ¶
func (v2 *V2utils) UnsetTemplate()
Click to show internal directories.
Click to hide internal directories.