Documentation
¶
Index ¶
- func Base64StdDecode(s string) (string, error)
- func Base64URLDecode(s string) (string, error)
- func ChangeProxyNode() error
- func NewProxyPoolGrpcClient() (c g.ProxyPoolServiceClient, conn *grpc.ClientConn)
- func RequestProxyPoolGrpcOnce(h func(c g.ProxyPoolServiceClient, ctx context.Context))
- func RunProxyPoolGrpcServer()
- func StartServer()
- type ProxyNode
- func (p *ProxyNode) GetId() string
- func (p ProxyNode) IsOk() bool
- func (p ProxyNode) IsRunning() bool
- func (p *ProxyNode) KillPidByLocalPort() (hasPid int, killResult error)
- func (p *ProxyNode) SetV2ray(n V2rayNode) *ProxyNode
- func (p *ProxyNode) Start(path string) (err error)
- func (p *ProxyNode) Stop() error
- type ProxyNodes
- type ProxyPool
- func (p *ProxyPool) ActiveNode(n ProxyNode) error
- func (p *ProxyPool) AddNode(n ProxyNode)
- func (p *ProxyPool) AddSpeedNode(key string, n ProxyNode)
- func (p ProxyPool) GetLocalAddr(n ProxyNode) string
- func (p *ProxyPool) GetNodes(domain string) ProxyNodes
- func (p *ProxyPool) InitSubscribeData() *ProxyPool
- func (p *ProxyPool) KillAllNodes() (total, runport, kill, fail int)
- func (p *ProxyPool) RemoveNode(n ProxyNode)
- func (p *ProxyPool) SetLocalAddr(n *ProxyNode, port int) string
- func (p *ProxyPool) SetLocalPortStart(port int) *ProxyPool
- func (p *ProxyPool) SetNodes(nds []ProxyNode)
- func (p *ProxyPool) SetSubscribeRawData(d string) *ProxyPool
- func (p *ProxyPool) SetSubscribeUrl(d string) *ProxyPool
- func (p *ProxyPool) SetTestMaxDuration(d time.Duration) *ProxyPool
- func (p *ProxyPool) SetTestUrl(turl string) *ProxyPool
- func (p *ProxyPool) SetV2rayPath(path string) *ProxyPool
- func (p *ProxyPool) StartAll() error
- func (p *ProxyPool) StopAll() error
- func (p *ProxyPool) TestAll()
- func (p *ProxyPool) TestAllForce()
- func (p *ProxyPool) UpdateAfterStopAll()
- func (p *ProxyPool) UpdateNode(n ProxyNode) error
- func (p *ProxyPool) UpdateSubscribe() (total, add int)
- type ProxyPoolServer
- func (s ProxyPoolServer) ActiveProxyNode(ctx context.Context, req *g.ProxyNode) (result *g.OptResult, err error)
- func (s ProxyPoolServer) GetProxyNodes(ctx context.Context, req *g.ProxyNode) (*g.ProxyNodes, error)
- func (s ProxyPoolServer) GetProxyNodesByDomain(ctx context.Context, req *g.OptRequestDomain) (*g.ProxyNodes, error)
- func (s ProxyPoolServer) KillAllNodes(ctx context.Context, req *g.OptRequest) (result *g.KillNodesResult, err error)
- func (s ProxyPoolServer) SetTestUrl(ctx context.Context, req *g.OptRequestUrl) (result *g.OptResult, err error)
- func (s ProxyPoolServer) StartProxyPoolAll(ctx context.Context, req *g.OptRequest) (result *g.OptResult, err error)
- func (s ProxyPoolServer) StopProxyPoolAll(ctx context.Context, req *g.OptRequest) (result *g.OptResult, err error)
- func (s ProxyPoolServer) TestProxyPoolAll(ctx context.Context, req *g.OptRequest) (result *g.OptResult, err error)
- func (s ProxyPoolServer) TestProxyPoolAllForce(ctx context.Context, req *g.OptRequest) (result *g.OptResult, err error)
- func (s ProxyPoolServer) UpdateProxySubscribe(ctx context.Context, req *g.OptRequest) (result *g.UpdateSubscribeResult, err error)
- type V2rayConfigV4
- type V2rayConfigV5
- type V2rayInbound
- type V2rayNode
- type V2rayOutbound
- type V2rayRouteRule
- type V2rayServer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Base64StdDecode ¶
封装base64.StdEncoding进行解码,加入了长度补全,换行删除。当error时,返回输入和err
func Base64URLDecode ¶
封装base64.URLEncoding进行解码,加入了长度补全,换行删除。当error时,返回输入和err
func ChangeProxyNode ¶
func ChangeProxyNode() error
func NewProxyPoolGrpcClient ¶
func NewProxyPoolGrpcClient() (c g.ProxyPoolServiceClient, conn *grpc.ClientConn)
NewProxyPoolGrpcClient c, conn := NewProxyPoolGrpcClient() defer conn.Close() ctx, cancel := context.WithTimeout(context.Background(), time.Second) defer cancel() nds, err := c.GetProxyNodes(ctx, &ProxyNode{IsRunning: true})
func RequestProxyPoolGrpcOnce ¶
func RequestProxyPoolGrpcOnce(h func(c g.ProxyPoolServiceClient, ctx context.Context))
func RunProxyPoolGrpcServer ¶
func RunProxyPoolGrpcServer()
func StartServer ¶
func StartServer()
Types ¶
type ProxyNode ¶
type ProxyNode struct {
Index, LocalPort int
Id string
RemoteAddr, Title string
TestUrl string
Speed time.Duration
TestAt time.Time
// contains filtered or unexported fields
}
func NewProxyNodeByV2ray ¶
func (*ProxyNode) KillPidByLocalPort ¶
type ProxyNodes ¶
type ProxyNodes []ProxyNode
func GetRunningNodes ¶
func GetRunningNodes() ProxyNodes
func (ProxyNodes) Len ¶
func (s ProxyNodes) Len() int
func (ProxyNodes) Less ¶
func (s ProxyNodes) Less(i, j int) bool
func (*ProxyNodes) SortBySpeed ¶
func (s *ProxyNodes) SortBySpeed()
func (ProxyNodes) Swap ¶
func (s ProxyNodes) Swap(i, j int)
type ProxyPool ¶
type ProxyPool struct {
IsLock bool
// contains filtered or unexported fields
}
func GetProxyPool ¶
func GetProxyPool() *ProxyPool
func NewProxyPool ¶
func NewProxyPool() *ProxyPool
func (*ProxyPool) ActiveNode ¶
func (*ProxyPool) AddSpeedNode ¶
func (ProxyPool) GetLocalAddr ¶
func (*ProxyPool) GetNodes ¶
func (p *ProxyPool) GetNodes(domain string) ProxyNodes
func (*ProxyPool) InitSubscribeData ¶
func (*ProxyPool) KillAllNodes ¶
func (*ProxyPool) RemoveNode ¶
func (*ProxyPool) SetLocalPortStart ¶
func (*ProxyPool) SetSubscribeRawData ¶
func (*ProxyPool) SetSubscribeUrl ¶
func (*ProxyPool) SetTestMaxDuration ¶
func (*ProxyPool) SetTestUrl ¶
func (*ProxyPool) SetV2rayPath ¶
func (*ProxyPool) TestAllForce ¶
func (p *ProxyPool) TestAllForce()
func (*ProxyPool) UpdateAfterStopAll ¶
func (p *ProxyPool) UpdateAfterStopAll()
func (*ProxyPool) UpdateNode ¶
func (*ProxyPool) UpdateSubscribe ¶
type ProxyPoolServer ¶
type ProxyPoolServer struct {
g.UnimplementedProxyPoolServiceServer
}
func (ProxyPoolServer) ActiveProxyNode ¶
func (ProxyPoolServer) GetProxyNodes ¶
func (s ProxyPoolServer) GetProxyNodes(ctx context.Context, req *g.ProxyNode) (*g.ProxyNodes, error)
func (ProxyPoolServer) GetProxyNodesByDomain ¶
func (s ProxyPoolServer) GetProxyNodesByDomain(ctx context.Context, req *g.OptRequestDomain) (*g.ProxyNodes, error)
func (ProxyPoolServer) KillAllNodes ¶
func (s ProxyPoolServer) KillAllNodes(ctx context.Context, req *g.OptRequest) (result *g.KillNodesResult, err error)
func (ProxyPoolServer) SetTestUrl ¶
func (s ProxyPoolServer) SetTestUrl(ctx context.Context, req *g.OptRequestUrl) (result *g.OptResult, err error)
func (ProxyPoolServer) StartProxyPoolAll ¶
func (s ProxyPoolServer) StartProxyPoolAll(ctx context.Context, req *g.OptRequest) (result *g.OptResult, err error)
func (ProxyPoolServer) StopProxyPoolAll ¶
func (s ProxyPoolServer) StopProxyPoolAll(ctx context.Context, req *g.OptRequest) (result *g.OptResult, err error)
func (ProxyPoolServer) TestProxyPoolAll ¶
func (s ProxyPoolServer) TestProxyPoolAll(ctx context.Context, req *g.OptRequest) (result *g.OptResult, err error)
func (ProxyPoolServer) TestProxyPoolAllForce ¶
func (s ProxyPoolServer) TestProxyPoolAllForce(ctx context.Context, req *g.OptRequest) (result *g.OptResult, err error)
func (ProxyPoolServer) UpdateProxySubscribe ¶
func (s ProxyPoolServer) UpdateProxySubscribe(ctx context.Context, req *g.OptRequest) (result *g.UpdateSubscribeResult, err error)
type V2rayConfigV4 ¶
type V2rayConfigV4 struct {
Log json.RawMessage `json:"log"`
// Dns json.RawMessage `json:"dns"`
Routing json.RawMessage `json:"routing"`
Inbounds []V2rayInbound `json:"inbounds"`
Outbounds []V2rayOutbound `json:"outbounds"`
}
type V2rayConfigV5 ¶
type V2rayConfigV5 struct {
Log json.RawMessage `json:"log"`
Dns json.RawMessage `json:"dns"`
Router json.RawMessage `json:"router"`
Inbounds []V2rayInbound `json:"inbounds"`
Outbounds []V2rayOutbound `json:"outbounds"`
Services map[string]json.RawMessage `json:"services"`
Extensions []json.RawMessage `json:"extension"`
}
type V2rayInbound ¶
type V2rayInbound struct {
Protocol string
Port int
Listen string // 默认值为 "0.0.0.0"
Tag string // 此入站连接的标识,用于在其它的配置中定位此连接。当其不为空时,其值必须在所有 tag 中唯一。
Settings json.RawMessage `json:"settings"` // {"auth":"noauth","udp":true,"ip":"%s"}
}
v4 {"port":%d,"listen":"%s","protocol":"http","settings":{"auth":"noauth","udp":true,"ip":"%s"}}
type V2rayNode ¶
"protocol":"vmess"
func ParseV2rayNodes ¶
ParseNodes 解析节点 Add, Ps ... {"add":"jp6.v2u9.top","host":"","id":"0999AE93-1330-4A75-DBC1-0DD545F7DD60","net":"ws","path":"","port":"41444","ps":"u9un-v2-JP-Tokyo6(1)","tls":"","v":2,"aid":0,"type":"none"}
type V2rayOutbound ¶
type V2rayOutbound struct {
Protocol string `json:"protocol"`
// SendThrough string // 用于发送数据的 IP 地址,当主机有多个 IP 地址时有效,默认值为 "0.0.0.0"。
Tag string `json:"tag"`
Settings json.RawMessage `json:"settings"`
// "streamSettings":{"network":"%s","tlsSettings":{"disableSystemRoot":false},"wsSettings":{"path":""},"xtlsSettings":{"disableSystemRoot":false}}
StreamSetting json.RawMessage `json:"streamSettings"`
}
type V2rayRouteRule ¶
type V2rayRouteRule struct {
DomainMatcher string `json:"domainMatcher"`
Type string `json:"type"`
Domains []string `json:"domains"`
Ip []string `json:"ip"`
// InboundTag []string `json:"inboundTag"`
OutboundTag string `json:"outboundTag"` //direct
}
V2rayRouteRule https://www.v2fly.org/config/routing.html#ruleobject
type V2rayServer ¶
type V2rayServer struct {
// contains filtered or unexported fields
}
func NewV2ray ¶
func NewV2ray(v2rayPath string, localPort int) *V2rayServer
func (*V2rayServer) Run ¶
func (v *V2rayServer) Run()
func (*V2rayServer) SetNode ¶
func (v *V2rayServer) SetNode(n V2rayNode) *V2rayServer
func (*V2rayServer) SetPort ¶
func (v *V2rayServer) SetPort(port int) *V2rayServer