Skip to content

Commit

Permalink
refactor: crawl fuzzy rename to auto
Browse files Browse the repository at this point in the history
  • Loading branch information
snakem982 committed Dec 20, 2024
1 parent 9c747fe commit 648b50e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 139 deletions.
1 change: 1 addition & 0 deletions backend/constant/constant.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const (
CollectV2ray = "v2ray"
CollectSharelink = "share"
CollectFuzzy = "fuzzy"
CollectAuto = "auto"
CollectSingBox = "sing"
)

Expand Down
3 changes: 2 additions & 1 deletion backend/spider/fuzzy.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (

func init() {
Register(constant.CollectFuzzy, NewFuzzyCollect)
Register(constant.CollectAuto, NewFuzzyCollect)
}

type Fuzzy struct {
Expand All @@ -29,7 +30,7 @@ func (c *Fuzzy) Get() []map[string]any {
func (c *Fuzzy) Get2ChanWG(pc chan []map[string]any, wg *sync.WaitGroup) {
defer wg.Done()
nodes := c.Get()
log.Infoln("STATISTIC: Fuzzy count=%d url=%s", len(nodes), c.Url)
log.Infoln("STATISTIC: Auto|Fuzzy count=%d url=%s", len(nodes), c.Url)
if len(nodes) > 0 {
pc <- nodes
}
Expand Down
126 changes: 0 additions & 126 deletions backend/spider/singbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,129 +42,3 @@ func (c *SingBox) Get2ChanWG(pc chan []map[string]any, wg *sync.WaitGroup) {
func NewSingBoxCollect(g Getter) Collect {
return &SingBox{Url: g.Url, Headers: g.Headers}
}

type SingBoxOption struct {
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
Server string `json:"server,omitempty"`
ServerPort int `json:"server_port,omitempty"`
Tag string `json:"tag,omitempty"`
TLS *SingTLS `json:"tls,omitempty"`
Transport *SingTransport `json:"transport,omitempty"`
Type string `json:"type,omitempty"`
Method string `json:"method,omitempty"`
AlterID int `json:"alter_id,omitempty"`
Security string `json:"security,omitempty"`
UUID string `json:"uuid,omitempty"`
Default string `json:"default,omitempty"`
Outbounds []string `json:"outbounds,omitempty"`
Interval string `json:"interval,omitempty"`
Tolerance int `json:"tolerance,omitempty"`
URL string `json:"url,omitempty"`
Network string `json:"network,omitempty"`
Plugin string `json:"plugin,omitempty"`
PluginOpts string `json:"plugin_opts,omitempty"`
ObfsParam string `json:"obfs_param,omitempty"`
Protocol string `json:"protocol,omitempty"`
ProtocolParam string `json:"protocol_param,omitempty"`
Flow string `json:"flow,omitempty"`
PacketEncoding string `json:"packet_encoding,omitempty"`
AuthStr string `json:"auth_str,omitempty"`
DisableMtuDiscovery bool `json:"disable_mtu_discovery,omitempty"`
Down string `json:"down,omitempty"`
DownMbps int `json:"down_mbps,omitempty"`
RecvWindow int `json:"recv_window,omitempty"`
RecvWindowConn int `json:"recv_window_conn,omitempty"`
Up string `json:"up,omitempty"`
UpMbps int `json:"up_mbps,omitempty"`
Detour string `json:"detour,omitempty"`
Multiplex *SingMultiplex `json:"multiplex,omitempty"`
Version int `json:"version,omitempty"`
UdpOverTcp *SingUdpOverTcp `json:"udp_over_tcp,omitempty"`
SystemInterface bool `json:"system_interface,omitempty"`
InterfaceName string `json:"interface_name,omitempty"`
LocalAddress []string `json:"local_address,omitempty"`
PrivateKey string `json:"private_key,omitempty"`
Peers []*SingWireguardMultiPeer `json:"peers,omitempty"`
PeerPublicKey string `json:"peer_public_key,omitempty"`
PreSharedKey string `json:"pre_shared_key,omitempty"`
Reserved []int64 `json:"reserved,omitempty"`
MTU uint `json:"mtu,omitempty"`
CongestionController string `json:"congestion_control,omitempty"`
UdpRelayMode string `json:"udp_relay_mode,omitempty"`
ZeroRttHandshake bool `json:"zero_rtt_handshake,omitempty"`
Heartbeat string `json:"heartbeat,omitempty"`
Obfs *SingObfs `json:"obfs,omitempty"`
Ignored bool `json:"-"`
TcpFastOpen bool `json:"tcp_fast_open,omitempty"`
TcpMultiPath bool `json:"tcp_multi_path,omitempty"`
Visible []string `json:"-"`
}

type SingUdpOverTcp struct {
Enabled bool `json:"enabled,omitempty"`
}

type SingTLS struct {
Enabled bool `json:"enabled,omitempty"`
ServerName string `json:"server_name,omitempty"`
Alpn []string `json:"alpn,omitempty"`
Insecure bool `json:"insecure,omitempty"`
Utls *SingUtls `json:"utls,omitempty"`
Reality *SingReality `json:"reality,omitempty"`
Certificate string `json:"certificate,omitempty"`
}

type SingUtls struct {
Enabled bool `json:"enabled,omitempty"`
Fingerprint string `json:"fingerprint,omitempty"`
}

type SingReality struct {
Enabled bool `json:"enabled,omitempty"`
PublicKey string `json:"public_key,omitempty"`
ShortID string `json:"short_id,omitempty"`
}

type SingTransport struct {
Headers map[string]any `json:"headers,omitempty"`
Path string `json:"path,omitempty"`
Type string `json:"type,omitempty"`
EarlyDataHeaderName string `json:"early_data_header_name,omitempty"`
MaxEarlyData int `json:"max_early_data,omitempty"`
Host any `json:"host,omitempty"`
Method string `json:"method,omitempty"`
ServiceName string `json:"service_name,omitempty"`
}

type SingMultiplex struct {
Enabled bool `json:"enabled,omitempty"`
MaxConnections int `json:"max_connections,omitempty"`
MinStreams int `json:"min_streams,omitempty"`
MaxStreams int `json:"max_streams,omitempty"`
Padding bool `json:"padding,omitempty"`
Protocol string `json:"protocol,omitempty"`
}

type SingWireguardMultiPeer struct {
Server string `json:"server,omitempty"`
ServerPort int `json:"server_port,omitempty"`
PublicKey string `json:"public_key,omitempty"`
PreSharedKey string `json:"pre_shared_key,omitempty"`
AllowedIps []string `json:"allowed_ips,omitempty"`
Reserved []int64 `json:"reserved,omitempty"`
}

type SingObfs struct {
Value string
Type string
}

type SingObfsHysteria2 struct {
Password string `json:"password"`
Type string `json:"type"`
}

type SingConfig struct {
Outbounds []SingBoxOption `json:"outbounds,omitempty"`
}
21 changes: 9 additions & 12 deletions frontend/src/views/Crawl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ function addShow() {
dialogFormVisible.value = true;
addFlag.value = true;
form.id = ""
form.type = "fuzzy"
form.type = "auto"
form.url = search.value || ""
form.auth = ""
form.ua = ""
Expand Down Expand Up @@ -344,11 +344,11 @@ async function filter() {
<el-form :model="form">
<el-form-item label="爬取类型 Type" :label-width="formLabelWidth">
<el-select v-model="form.type" placeholder="选择类型 Select type" style="width: 100%">
<el-option label="自动识别(auto identify)" value="auto"/>
<el-option label="clash订阅(clash subscription)" value="clash"/>
<el-option label="v2ray订阅(v2ray subscription)" value="v2ray"/>
<el-option label="sing-box订阅(sing-box subscription)" value="sing"/>
<el-option label="分享链接(share link)" value="share"/>
<el-option label="模糊爬取(fuzzy crawling)" value="fuzzy"/>
<el-option label="自定义输入(custom input)" value="local"/>
</el-select>
</el-form-item>
Expand Down Expand Up @@ -416,6 +416,13 @@ async function filter() {
<div>
<el-text class="el-text--primary title">2、爬取类型 Crawl Type</el-text>
<div class="content">
<el-text>- 自动识别(auto identify)</el-text>
<br>
<el-text>&emsp;自动识别url地址返回的内容。</el-text>
<br>
<el-text>&emsp;Automatically identify the content returned by the URL address.</el-text>
<br>
<br>
<el-text>- clash订阅(clash subscription)</el-text>
<br>
<el-text>&emsp;一般用yaml编码</el-text>
Expand Down Expand Up @@ -460,16 +467,6 @@ async function filter() {
<el-text>&emsp;hysteria2://...</el-text>
<br>
<el-text>&emsp;hy2://...</el-text>
<br><br>
<el-text>- 模糊爬取(fuzzy crawling)</el-text>
<br>
<el-text>&emsp;当内容既包含订阅地址又包含分享链接时使用。</el-text>
<br>
<el-text>&emsp;不知道填写什么类型时也可以使用此选项。</el-text>
<br>
<el-text>&emsp;Used when content contains subscription addresses and sharing links.</el-text>
<br>
<el-text>&emsp;You can also use this option when you don't know what type to fill in.</el-text>
<br>
<br>
<el-text>- 自定义输入(custom input)</el-text>
Expand Down

0 comments on commit 648b50e

Please sign in to comment.