Documentation
¶
Index ¶
- Constants
- Variables
- func FormatDuration(duration time.Duration) string
- func GetRemarks(link string) (string, string, error)
- func ParseLinks(message string) ([]string, error)
- func ServeFile(port int) 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 Message
- type MessageWriter
- type OutputMessageWriter
- 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 )
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 TestContext ¶
func TestContext(ctx context.Context, options ProfileTestOptions, w MessageWriter) (render.Nodes, error)
use as golang api
func TestFromCMD ¶
Types ¶
type EmptyMessageWriter ¶
type EmptyMessageWriter struct {
}
func (*EmptyMessageWriter) WriteMessage ¶
func (w *EmptyMessageWriter) WriteMessage(messageType int, data []byte) error
type GetSubscriptionLink ¶
type Message ¶
type Message struct {
ID int `json:"id"`
Info string `json:"info"`
Remarks string `json:"remarks"`
Server string `json:"server"`
Group string `json:"group"`
Ping int64 `json:"ping"`
Lost string `json:"lost"`
Speed string `json:"speed"`
MaxSpeed string `json:"maxspeed"`
Traffic int64 `json:"traffic"`
Link string `json:"link"`
Protocol string `json:"protocol"`
PicData string `json:"data,omitempty"`
Servers []Message `json:"servers"`
}
type MessageWriter ¶
type OutputMessageWriter ¶
type OutputMessageWriter struct {
}
func (*OutputMessageWriter) WriteMessage ¶
func (p *OutputMessageWriter) WriteMessage(messageType int, data []byte) error
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, links []string, max int, trafficChan chan<- int64) (chan render.Node, error)
api
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"`
GeneratePicMode int `json:"generatePicMode"` // 0: base64 1:file path 2: no pic
}
Click to show internal directories.
Click to hide internal directories.