Documentation
¶
Index ¶
- Constants
- Variables
- func FormatDuration(duration time.Duration) string
- func GetRemarks(link string) (string, string, error)
- func ParseLinks(message string) ([]string, error)
- func ParseLinksWithOption(message string, opt ParseOption) ([]string, error)
- func PeekClash(input string, n int) ([]string, error)
- func ServeFile(port int) error
- func TestAsyncContext(ctx context.Context, options ProfileTestOptions) (chan render.Node, []string, error)
- func TestContext(ctx context.Context, options ProfileTestOptions, w MessageWriter) (render.Nodes, error)
- func TestFromCMD(subscription string, configPath *string) error
- type EmptyMessageWriter
- type GetSubscriptionLink
- type JSONOutput
- type Message
- type MessageWriter
- type OutputMessageWriter
- type PAESE_TYPE
- type ParseOption
- type ProfileTest
- type ProfileTestOptions
- type TestResult
Constants ¶
View Source
const ( TROJAN_DEFAULT_GROUP = "TrojanProvider" V2RAY_DEFAULT_GROUP = "V2RayProvider" SS_DEFAULT_GROUP = "SSProvider" SSR_DEFAULT_GROUP = "SSRProvider" SPEEDTEST_ERROR_NONODES = "{\"info\":\"error\",\"reason\":\"nonodes\"}\n" )
View Source
const ( PIC_BASE64 = iota PIC_PATH PIC_NONE JSON_OUTPUT TEXT_OUTPUT )
View Source
const ( SpeedOnly = "speedonly" PingOnly = "pingonly" ALLTEST = iota RETEST )
Variables ¶
View Source
var (
ErrInvalidData = errors.New("invalid data")
)
View Source
var FontBytes []byte
Functions ¶
func FormatDuration ¶
func ParseLinksWithOption ¶ added in v0.15.0
func ParseLinksWithOption(message string, opt ParseOption) ([]string, error)
api
func TestAsyncContext ¶ added in v0.12.0
func TestAsyncContext(ctx context.Context, options ProfileTestOptions) (chan render.Node, []string, error)
use as golang api
func TestContext ¶ added in v0.8.0
func TestContext(ctx context.Context, options ProfileTestOptions, w MessageWriter) (render.Nodes, error)
use as golang api
func TestFromCMD ¶
Types ¶
type EmptyMessageWriter ¶ added in v0.8.0
type EmptyMessageWriter struct {
}
func (*EmptyMessageWriter) WriteMessage ¶ added in v0.8.0
func (w *EmptyMessageWriter) WriteMessage(messageType int, data []byte) error
type GetSubscriptionLink ¶ added in v0.8.0
type JSONOutput ¶ added in v0.13.1
type Message ¶
type Message struct {
ID int `json:"id"`
Info string `json:"info"`
Remarks string `json:"remarks,omitempty"`
Server string `json:"server,omitempty"`
Group string `json:"group,omitempty"`
Ping int64 `json:"ping,omitempty"`
Lost string `json:"lost,omitempty"`
Speed string `json:"speed,omitempty"`
MaxSpeed string `json:"maxspeed,omitempty"`
Traffic int64 `json:"traffic,omitempty"`
Link string `json:"link,omitempty"`
Protocol string `json:"protocol,omitempty"`
PicData string `json:"data,omitempty"`
Servers []Message `json:"servers,omitempty"`
}
type MessageWriter ¶
type OutputMessageWriter ¶
type OutputMessageWriter struct {
}
func (*OutputMessageWriter) WriteMessage ¶
func (p *OutputMessageWriter) WriteMessage(messageType int, data []byte) error
type PAESE_TYPE ¶ added in v0.15.0
type PAESE_TYPE int
const ( PARSE_ANY PAESE_TYPE = iota PARSE_URL PARSE_FILE PARSE_BASE64 PARSE_CLASH PARSE_PROFILE )
type ParseOption ¶ added in v0.15.0
type ParseOption struct {
Type PAESE_TYPE
}
type ProfileTest ¶
type ProfileTest struct {
Writer MessageWriter
Options *ProfileTestOptions
MessageType int
Links []string
// contains filtered or unexported fields
}
func (*ProfileTest) TestAll ¶
func (p *ProfileTest) TestAll(ctx context.Context, trafficChan chan<- int64) (chan render.Node, error)
api render.Node contain the final test result
func (*ProfileTest) WriteMessage ¶
func (p *ProfileTest) WriteMessage(data []byte) error
func (*ProfileTest) WriteString ¶
func (p *ProfileTest) WriteString(data string) error
type ProfileTestOptions ¶
type ProfileTestOptions struct {
GroupName string `json:"group"`
SpeedTestMode string `json:"speedtestMode"` // speedonly pingonly all
PingMethod string `json:"pingMethod"` // googleping
SortMethod string `json:"sortMethod"` // speed rspeed ping rping
Concurrency int `json:"concurrency"`
TestMode int `json:"testMode"` // 2: ALLTEST 3: RETEST
TestIDs []int `json:"testids"`
Timeout time.Duration `json:"timeout"`
Links []string `json:"links"`
Subscription string `json:"subscription"`
Language string `json:"language"`
FontSize int `json:"fontSize"`
Theme string `json:"theme"`
Unique bool `json:"unique"`
GeneratePicMode int `json:"generatePicMode"` // 0: base64 1:pic path 2: no pic 3: json @deprecated use outputMode
OutputMode int `json:"outputMode"`
}
Click to show internal directories.
Click to hide internal directories.