mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2024-11-12 20:31:17 +08:00
chore: hello mihomo
This commit is contained in:
parent
8c3557e96b
commit
17c9d507be
24
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
24
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@ -13,8 +13,8 @@ Please verify that you've followed these steps
|
|||||||
"
|
"
|
||||||
options:
|
options:
|
||||||
- label: "
|
- label: "
|
||||||
确保你使用的是**本仓库**最新的的 clash 或 clash Alpha 版本
|
确保你使用的是**本仓库**最新的的 mihomo 或 mihomo Alpha 版本
|
||||||
Ensure you are using the latest version of Clash or Clash Premium from **this repository**.
|
Ensure you are using the latest version of Mihomo or Mihomo Alpha from **this repository**.
|
||||||
"
|
"
|
||||||
required: true
|
required: true
|
||||||
- label: "
|
- label: "
|
||||||
@ -38,14 +38,14 @@ I have read the [documentation](https://wiki.metacubex.one/) and was unable to s
|
|||||||
"
|
"
|
||||||
required: true
|
required: true
|
||||||
- label: "
|
- label: "
|
||||||
这是 Clash 核心的问题,并非我所使用的 Clash 衍生版本(如 OpenClash、KoolClash 等)的特定问题
|
这是 Mihomo 核心的问题,并非我所使用的 Mihomo 衍生版本(如 OpenMihomo、KoolMihomo 等)的特定问题
|
||||||
This is an issue of the Clash core *per se*, not to the derivatives of Clash, like OpenClash or KoolClash.
|
This is an issue of the Mihomo core *per se*, not to the derivatives of Mihomo, like OpenMihomo or KoolMihomo.
|
||||||
"
|
"
|
||||||
required: true
|
required: true
|
||||||
- type: input
|
- type: input
|
||||||
attributes:
|
attributes:
|
||||||
label: Clash version
|
label: Mihomo version
|
||||||
description: "use `clash -v`"
|
description: "use `mihomo -v`"
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: dropdown
|
- type: dropdown
|
||||||
@ -61,20 +61,20 @@ This is an issue of the Clash core *per se*, not to the derivatives of Clash, li
|
|||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
render: yaml
|
render: yaml
|
||||||
label: "Clash config"
|
label: "Mihomo config"
|
||||||
description: "
|
description: "
|
||||||
在下方附上 Clash core 配置文件,请确保配置文件中没有敏感信息(比如:服务器地址,密码,端口等)
|
在下方附上 Mihomo core 配置文件,请确保配置文件中没有敏感信息(比如:服务器地址,密码,端口等)
|
||||||
Paste the Clash core configuration file below, please make sure that there is no sensitive information in the configuration file (e.g., server address/url, password, port)
|
Paste the Mihomo core configuration file below, please make sure that there is no sensitive information in the configuration file (e.g., server address/url, password, port)
|
||||||
"
|
"
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
render: shell
|
render: shell
|
||||||
label: Clash log
|
label: Mihomo log
|
||||||
description: "
|
description: "
|
||||||
在下方附上 Clash Core 的日志,log level 使用 DEBUG
|
在下方附上 Mihomo Core 的日志,log level 使用 DEBUG
|
||||||
Paste the Clash core log below with the log level set to `DEBUG`.
|
Paste the Mihomo core log below with the log level set to `DEBUG`.
|
||||||
"
|
"
|
||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
|
6
.github/ISSUE_TEMPLATE/config.yml
vendored
6
.github/ISSUE_TEMPLATE/config.yml
vendored
@ -1,5 +1,5 @@
|
|||||||
blank_issues_enabled: false
|
blank_issues_enabled: false
|
||||||
contact_links:
|
contact_links:
|
||||||
- name: Clash.Meta Community Support
|
- name: mihomo Community Support
|
||||||
url: https://github.com/MetaCubeX/Clash.Meta/discussions
|
url: https://github.com/MetaCubeX/mihomo/discussions
|
||||||
about: Please ask and answer questions about Clash.Meta here.
|
about: Please ask and answer questions about mihomo here.
|
||||||
|
2
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
2
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
@ -25,7 +25,7 @@ I have read the [documentation](https://wiki.metacubex.one/) and was unable to s
|
|||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: Description
|
label: Description
|
||||||
description: 请详细、清晰地表达你要提出的论述,例如这个问题如何影响到你?你想实现什么功能?目前 Clash Core 的行为是什麽?
|
description: 请详细、清晰地表达你要提出的论述,例如这个问题如何影响到你?你想实现什么功能?目前 Mihomo Core 的行为是什麽?
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: textarea
|
- type: textarea
|
||||||
|
26
.github/rename-cgo.sh
vendored
26
.github/rename-cgo.sh
vendored
@ -5,25 +5,25 @@ for FILENAME in $FILENAMES
|
|||||||
do
|
do
|
||||||
if [[ $FILENAME =~ "darwin-10.16-arm64" ]];then
|
if [[ $FILENAME =~ "darwin-10.16-arm64" ]];then
|
||||||
echo "rename darwin-10.16-arm64 $FILENAME"
|
echo "rename darwin-10.16-arm64 $FILENAME"
|
||||||
mv $FILENAME clash.meta-darwin-arm64-cgo
|
mv $FILENAME mihomo-darwin-arm64-cgo
|
||||||
elif [[ $FILENAME =~ "darwin-10.16-amd64" ]];then
|
elif [[ $FILENAME =~ "darwin-10.16-amd64" ]];then
|
||||||
echo "rename darwin-10.16-amd64 $FILENAME"
|
echo "rename darwin-10.16-amd64 $FILENAME"
|
||||||
mv $FILENAME clash.meta-darwin-amd64-cgo
|
mv $FILENAME mihomo-darwin-amd64-cgo
|
||||||
elif [[ $FILENAME =~ "windows-4.0-386" ]];then
|
elif [[ $FILENAME =~ "windows-4.0-386" ]];then
|
||||||
echo "rename windows 386 $FILENAME"
|
echo "rename windows 386 $FILENAME"
|
||||||
mv $FILENAME clash.meta-windows-386-cgo.exe
|
mv $FILENAME mihomo-windows-386-cgo.exe
|
||||||
elif [[ $FILENAME =~ "windows-4.0-amd64" ]];then
|
elif [[ $FILENAME =~ "windows-4.0-amd64" ]];then
|
||||||
echo "rename windows amd64 $FILENAME"
|
echo "rename windows amd64 $FILENAME"
|
||||||
mv $FILENAME clash.meta-windows-amd64-cgo.exe
|
mv $FILENAME mihomo-windows-amd64-cgo.exe
|
||||||
elif [[ $FILENAME =~ "clash.meta-linux-arm-5" ]];then
|
elif [[ $FILENAME =~ "mihomo-linux-arm-5" ]];then
|
||||||
echo "rename clash.meta-linux-arm-5 $FILENAME"
|
echo "rename mihomo-linux-arm-5 $FILENAME"
|
||||||
mv $FILENAME clash.meta-linux-armv5-cgo
|
mv $FILENAME mihomo-linux-armv5-cgo
|
||||||
elif [[ $FILENAME =~ "clash.meta-linux-arm-6" ]];then
|
elif [[ $FILENAME =~ "mihomo-linux-arm-6" ]];then
|
||||||
echo "rename clash.meta-linux-arm-6 $FILENAME"
|
echo "rename mihomo-linux-arm-6 $FILENAME"
|
||||||
mv $FILENAME clash.meta-linux-armv6-cgo
|
mv $FILENAME mihomo-linux-armv6-cgo
|
||||||
elif [[ $FILENAME =~ "clash.meta-linux-arm-7" ]];then
|
elif [[ $FILENAME =~ "mihomo-linux-arm-7" ]];then
|
||||||
echo "rename clash.meta-linux-arm-7 $FILENAME"
|
echo "rename mihomo-linux-arm-7 $FILENAME"
|
||||||
mv $FILENAME clash.meta-linux-armv7-cgo
|
mv $FILENAME mihomo-linux-armv7-cgo
|
||||||
elif [[ $FILENAME =~ "linux" ]];then
|
elif [[ $FILENAME =~ "linux" ]];then
|
||||||
echo "rename linux $FILENAME"
|
echo "rename linux $FILENAME"
|
||||||
mv $FILENAME $FILENAME-cgo
|
mv $FILENAME $FILENAME-cgo
|
||||||
|
@ -50,8 +50,8 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
git push origin android-real --force
|
git push origin android-real --force
|
||||||
|
|
||||||
# Send "core-updated" to MetaCubeX/ClashMetaForAndroid to trigger update-dependencies
|
# Send "core-updated" to MetaCubeX/MihomoForAndroid to trigger update-dependencies
|
||||||
trigger-CMFA-update:
|
trigger-MFA-update:
|
||||||
needs: update-dependencies
|
needs: update-dependencies
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@ -63,7 +63,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Trigger update-dependencies
|
- name: Trigger update-dependencies
|
||||||
run: |
|
run: |
|
||||||
curl -X POST https://api.github.com/repos/MetaCubeX/ClashMetaForAndroid/dispatches \
|
curl -X POST https://api.github.com/repos/MetaCubeX/MihomoForAndroid/dispatches \
|
||||||
-H "Accept: application/vnd.github.everest-preview+json" \
|
-H "Accept: application/vnd.github.everest-preview+json" \
|
||||||
-H "Authorization: token ${{ steps.generate-token.outputs.token }}" \
|
-H "Authorization: token ${{ steps.generate-token.outputs.token }}" \
|
||||||
-d '{"event_type": "core-updated"}'
|
-d '{"event_type": "core-updated"}'
|
8
.github/workflows/build.yml
vendored
8
.github/workflows/build.yml
vendored
@ -118,7 +118,7 @@ jobs:
|
|||||||
- name: Set ENV
|
- name: Set ENV
|
||||||
run: |
|
run: |
|
||||||
sudo timedatectl set-timezone "Asia/Shanghai"
|
sudo timedatectl set-timezone "Asia/Shanghai"
|
||||||
echo "NAME=clash.meta" >> $GITHUB_ENV
|
echo "NAME=mihomo" >> $GITHUB_ENV
|
||||||
echo "REPO=${{ github.repository }}" >> $GITHUB_ENV
|
echo "REPO=${{ github.repository }}" >> $GITHUB_ENV
|
||||||
echo "ShortSHA=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_ENV
|
echo "ShortSHA=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_ENV
|
||||||
echo "BUILDTIME=$(date)" >> $GITHUB_ENV
|
echo "BUILDTIME=$(date)" >> $GITHUB_ENV
|
||||||
@ -128,7 +128,7 @@ jobs:
|
|||||||
- name: Set ENV
|
- name: Set ENV
|
||||||
run: |
|
run: |
|
||||||
echo "TAGS=with_gvisor,with_lwip" >> $GITHUB_ENV
|
echo "TAGS=with_gvisor,with_lwip" >> $GITHUB_ENV
|
||||||
echo "LDFLAGS=-X 'github.com/Dreamacro/clash/constant.Version=${VERSION}' -X 'github.com/Dreamacro/clash/constant.BuildTime=${BUILDTIME}' -w -s -buildid=" >> $GITHUB_ENV
|
echo "LDFLAGS=-X 'github.com/metacubex/mihomo/constant.Version=${VERSION}' -X 'github.com/metacubex/mihomo/constant.BuildTime=${BUILDTIME}' -w -s -buildid=" >> $GITHUB_ENV
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
@ -153,7 +153,7 @@ jobs:
|
|||||||
- name: Build WithoutCGO
|
- name: Build WithoutCGO
|
||||||
if: ${{ matrix.job.type!='WithCGO' }}
|
if: ${{ matrix.job.type!='WithCGO' }}
|
||||||
env:
|
env:
|
||||||
NAME: Clash.Meta
|
NAME: mihomo
|
||||||
BINDIR: bin
|
BINDIR: bin
|
||||||
run: make -j$(($(nproc) + 1)) ${{ matrix.job.target }}
|
run: make -j$(($(nproc) + 1)) ${{ matrix.job.target }}
|
||||||
|
|
||||||
@ -271,7 +271,7 @@ jobs:
|
|||||||
Release created at ${{ env.BUILDTIME }}
|
Release created at ${{ env.BUILDTIME }}
|
||||||
Synchronize ${{ github.ref_name }} branch code updates, keeping only the latest version
|
Synchronize ${{ github.ref_name }} branch code updates, keeping only the latest version
|
||||||
<br>
|
<br>
|
||||||
[我应该下载哪个文件? / Which file should I download?](https://github.com/MetaCubeX/Clash.Meta/wiki/FAQ)
|
[我应该下载哪个文件? / Which file should I download?](https://github.com/MetaCubeX/mihomo/wiki/FAQ)
|
||||||
[查看文档 / Docs](https://metacubex.github.io/Meta-Docs/)
|
[查看文档 / Docs](https://metacubex.github.io/Meta-Docs/)
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ linters-settings:
|
|||||||
custom-order: true
|
custom-order: true
|
||||||
sections:
|
sections:
|
||||||
- standard
|
- standard
|
||||||
- prefix(github.com/Dreamacro/clash)
|
- prefix(github.com/metacubex/mihomo)
|
||||||
- default
|
- default
|
||||||
staticcheck:
|
staticcheck:
|
||||||
go: '1.19'
|
go: '1.19'
|
||||||
|
26
Dockerfile
26
Dockerfile
@ -3,25 +3,25 @@ ARG TARGETPLATFORM
|
|||||||
RUN echo "I'm building for $TARGETPLATFORM"
|
RUN echo "I'm building for $TARGETPLATFORM"
|
||||||
|
|
||||||
RUN apk add --no-cache gzip && \
|
RUN apk add --no-cache gzip && \
|
||||||
mkdir /clash-config && \
|
mkdir /mihomo-config && \
|
||||||
wget -O /clash-config/geoip.metadb https://fastly.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geoip.metadb && \
|
wget -O /mihomo-config/geoip.metadb https://fastly.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geoip.metadb && \
|
||||||
wget -O /clash-config/geosite.dat https://fastly.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geosite.dat && \
|
wget -O /mihomo-config/geosite.dat https://fastly.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geosite.dat && \
|
||||||
wget -O /clash-config/geoip.dat https://fastly.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geoip.dat
|
wget -O /mihomo-config/geoip.dat https://fastly.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geoip.dat
|
||||||
|
|
||||||
COPY docker/file-name.sh /clash/file-name.sh
|
COPY docker/file-name.sh /mihomo/file-name.sh
|
||||||
WORKDIR /clash
|
WORKDIR /mihomo
|
||||||
COPY bin/ bin/
|
COPY bin/ bin/
|
||||||
RUN FILE_NAME=`sh file-name.sh` && echo $FILE_NAME && \
|
RUN FILE_NAME=`sh file-name.sh` && echo $FILE_NAME && \
|
||||||
FILE_NAME=`ls bin/ | egrep "$FILE_NAME.*"|awk NR==1` && echo $FILE_NAME && \
|
FILE_NAME=`ls bin/ | egrep "$FILE_NAME.*"|awk NR==1` && echo $FILE_NAME && \
|
||||||
mv bin/$FILE_NAME clash.gz && gzip -d clash.gz && echo "$FILE_NAME" > /clash-config/test
|
mv bin/$FILE_NAME mihomo.gz && gzip -d mihomo.gz && echo "$FILE_NAME" > /mihomo-config/test
|
||||||
FROM alpine:latest
|
FROM alpine:latest
|
||||||
LABEL org.opencontainers.image.source="https://github.com/MetaCubeX/Clash.Meta"
|
LABEL org.opencontainers.image.source="https://github.com/MetaCubeX/mihomo"
|
||||||
|
|
||||||
RUN apk add --no-cache ca-certificates tzdata iptables
|
RUN apk add --no-cache ca-certificates tzdata iptables
|
||||||
|
|
||||||
VOLUME ["/root/.config/clash/"]
|
VOLUME ["/root/.config/mihomo/"]
|
||||||
|
|
||||||
COPY --from=builder /clash-config/ /root/.config/clash/
|
COPY --from=builder /mihomo-config/ /root/.config/mihomo/
|
||||||
COPY --from=builder /clash/clash /clash
|
COPY --from=builder /mihomo/mihomo /mihomo
|
||||||
RUN chmod +x /clash
|
RUN chmod +x /mihomo
|
||||||
ENTRYPOINT [ "/clash" ]
|
ENTRYPOINT [ "/mihomo" ]
|
||||||
|
6
Makefile
6
Makefile
@ -1,4 +1,4 @@
|
|||||||
NAME=clash.meta
|
NAME=mihomo
|
||||||
BINDIR=bin
|
BINDIR=bin
|
||||||
BRANCH=$(shell git branch --show-current)
|
BRANCH=$(shell git branch --show-current)
|
||||||
ifeq ($(BRANCH),Alpha)
|
ifeq ($(BRANCH),Alpha)
|
||||||
@ -12,8 +12,8 @@ VERSION=$(shell git rev-parse --short HEAD)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
BUILDTIME=$(shell date -u)
|
BUILDTIME=$(shell date -u)
|
||||||
GOBUILD=CGO_ENABLED=0 go build -tags with_gvisor -trimpath -ldflags '-X "github.com/Dreamacro/clash/constant.Version=$(VERSION)" \
|
GOBUILD=CGO_ENABLED=0 go build -tags with_gvisor -trimpath -ldflags '-X "github.com/metacubex/mihomo/constant.Version=$(VERSION)" \
|
||||||
-X "github.com/Dreamacro/clash/constant.BuildTime=$(BUILDTIME)" \
|
-X "github.com/metacubex/mihomo/constant.BuildTime=$(BUILDTIME)" \
|
||||||
-w -s -buildid='
|
-w -s -buildid='
|
||||||
|
|
||||||
PLATFORM_LIST = \
|
PLATFORM_LIST = \
|
||||||
|
28
README.md
28
README.md
@ -3,17 +3,17 @@
|
|||||||
<br>Meta Kernel<br>
|
<br>Meta Kernel<br>
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<h3 align="center">Another Clash Kernel.</h3>
|
<h3 align="center">Another Mihomo Kernel.</h3>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://goreportcard.com/report/github.com/Clash-Mini/Clash.Meta">
|
<a href="https://goreportcard.com/report/github.com/MetaCubeX/mihomo">
|
||||||
<img src="https://goreportcard.com/badge/github.com/Clash-Mini/Clash.Meta?style=flat-square">
|
<img src="https://goreportcard.com/badge/github.com/MetaCubeX/mihomo?style=flat-square">
|
||||||
</a>
|
</a>
|
||||||
<img src="https://img.shields.io/github/go-mod/go-version/Dreamacro/clash?style=flat-square">
|
<img src="https://img.shields.io/github/go-mod/go-version/MetaCubeX/mihomo?style=flat-square">
|
||||||
<a href="https://github.com/Clash-Mini/Clash.Meta/releases">
|
<a href="https://github.com/MetaCubeX/mihomo/releases">
|
||||||
<img src="https://img.shields.io/github/release/Clash-Mini/Clash.Meta/all.svg?style=flat-square">
|
<img src="https://img.shields.io/github/release/MetaCubeX/mihomo/all.svg?style=flat-square">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/Clash-Mini/Clash.Meta">
|
<a href="https://github.com/MetaCubeX/mihomo">
|
||||||
<img src="https://img.shields.io/badge/release-Meta-00b4f0?style=flat-square">
|
<img src="https://img.shields.io/badge/release-Meta-00b4f0?style=flat-square">
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
@ -27,7 +27,7 @@
|
|||||||
- Remote groups allow users to implement powerful rules. Supports automatic fallback, load balancing or auto select node
|
- Remote groups allow users to implement powerful rules. Supports automatic fallback, load balancing or auto select node
|
||||||
based off latency
|
based off latency
|
||||||
- Remote providers, allowing users to get node lists remotely instead of hard-coding in config
|
- Remote providers, allowing users to get node lists remotely instead of hard-coding in config
|
||||||
- Netfilter TCP redirecting. Deploy Clash on your Internet gateway with `iptables`.
|
- Netfilter TCP redirecting. Deploy Mihomo on your Internet gateway with `iptables`.
|
||||||
- Comprehensive HTTP RESTful API controller
|
- Comprehensive HTTP RESTful API controller
|
||||||
|
|
||||||
## Dashboard
|
## Dashboard
|
||||||
@ -36,22 +36,22 @@ A web dashboard with first-class support for this project has been created; it c
|
|||||||
|
|
||||||
## Configration example
|
## Configration example
|
||||||
|
|
||||||
Configuration example is located at [/docs/config.yaml](https://github.com/MetaCubeX/Clash.Meta/blob/Alpha/docs/config.yaml).
|
Configuration example is located at [/docs/config.yaml](https://github.com/MetaCubeX/mihomo/blob/Alpha/docs/config.yaml).
|
||||||
|
|
||||||
## Docs
|
## Docs
|
||||||
|
|
||||||
Documentation can be found in [Clash.Meta Docs](https://clash-meta.wiki).
|
Documentation can be found in [mihomo Docs](https://wiki.metacubex.one/).
|
||||||
|
|
||||||
## For development
|
## For development
|
||||||
|
|
||||||
Requirements:
|
Requirements:
|
||||||
[Go 1.20 or newer](https://go.dev/dl/)
|
[Go 1.20 or newer](https://go.dev/dl/)
|
||||||
|
|
||||||
Build Clash.Meta:
|
Build mihomo:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
git clone https://github.com/MetaCubeX/Clash.Meta.git
|
git clone https://github.com/MetaCubeX/mihomo.git
|
||||||
cd Clash.Meta && go mod download
|
cd mihomo && go mod download
|
||||||
go build
|
go build
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -98,4 +98,4 @@ API.
|
|||||||
|
|
||||||
This software is released under the GPL-3.0 license.
|
This software is released under the GPL-3.0 license.
|
||||||
|
|
||||||
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FDreamacro%2Fclash.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2FDreamacro%2Fclash?ref=badge_large)
|
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FMetaCubeX%2Fmihomo.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2FMetaCubeX%2Fmihomo?ref=badge_large)
|
||||||
|
@ -12,12 +12,12 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/common/atomic"
|
"github.com/metacubex/mihomo/common/atomic"
|
||||||
"github.com/Dreamacro/clash/common/queue"
|
"github.com/metacubex/mihomo/common/queue"
|
||||||
"github.com/Dreamacro/clash/common/utils"
|
"github.com/metacubex/mihomo/common/utils"
|
||||||
"github.com/Dreamacro/clash/component/dialer"
|
"github.com/metacubex/mihomo/component/dialer"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
"github.com/Dreamacro/clash/log"
|
"github.com/metacubex/mihomo/log"
|
||||||
|
|
||||||
"github.com/puzpuzpuz/xsync/v2"
|
"github.com/puzpuzpuz/xsync/v2"
|
||||||
)
|
)
|
||||||
|
@ -3,7 +3,7 @@ package inbound
|
|||||||
import (
|
import (
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Addition func(metadata *C.Metadata)
|
type Addition func(metadata *C.Metadata)
|
||||||
|
@ -4,7 +4,7 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"net/netip"
|
"net/netip"
|
||||||
|
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
)
|
)
|
||||||
|
|
||||||
var skipAuthPrefixes []netip.Prefix
|
var skipAuthPrefixes []netip.Prefix
|
||||||
|
@ -3,8 +3,8 @@ package inbound
|
|||||||
import (
|
import (
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
"github.com/Dreamacro/clash/transport/socks5"
|
"github.com/metacubex/mihomo/transport/socks5"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewHTTP receive normal http request and return HTTPContext
|
// NewHTTP receive normal http request and return HTTPContext
|
||||||
|
@ -4,7 +4,7 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewHTTPS receive CONNECT request and return ConnContext
|
// NewHTTPS receive CONNECT request and return ConnContext
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package inbound
|
package inbound
|
||||||
|
|
||||||
import (
|
import (
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
"github.com/Dreamacro/clash/transport/socks5"
|
"github.com/metacubex/mihomo/transport/socks5"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewPacket is PacketAdapter generator
|
// NewPacket is PacketAdapter generator
|
||||||
|
@ -3,8 +3,8 @@ package inbound
|
|||||||
import (
|
import (
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
"github.com/Dreamacro/clash/transport/socks5"
|
"github.com/metacubex/mihomo/transport/socks5"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewSocket receive TCP inbound and return ConnContext
|
// NewSocket receive TCP inbound and return ConnContext
|
||||||
|
@ -7,9 +7,9 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/common/nnip"
|
"github.com/metacubex/mihomo/common/nnip"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
"github.com/Dreamacro/clash/transport/socks5"
|
"github.com/metacubex/mihomo/transport/socks5"
|
||||||
)
|
)
|
||||||
|
|
||||||
func parseSocksAddr(target socks5.Addr) *C.Metadata {
|
func parseSocksAddr(target socks5.Addr) *C.Metadata {
|
||||||
|
@ -7,10 +7,10 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
N "github.com/Dreamacro/clash/common/net"
|
N "github.com/metacubex/mihomo/common/net"
|
||||||
"github.com/Dreamacro/clash/common/utils"
|
"github.com/metacubex/mihomo/common/utils"
|
||||||
"github.com/Dreamacro/clash/component/dialer"
|
"github.com/metacubex/mihomo/component/dialer"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Base struct {
|
type Base struct {
|
||||||
|
@ -5,10 +5,10 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"net/netip"
|
"net/netip"
|
||||||
|
|
||||||
N "github.com/Dreamacro/clash/common/net"
|
N "github.com/metacubex/mihomo/common/net"
|
||||||
"github.com/Dreamacro/clash/component/dialer"
|
"github.com/metacubex/mihomo/component/dialer"
|
||||||
"github.com/Dreamacro/clash/component/resolver"
|
"github.com/metacubex/mihomo/component/resolver"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Direct struct {
|
type Direct struct {
|
||||||
|
@ -13,11 +13,11 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
N "github.com/Dreamacro/clash/common/net"
|
N "github.com/metacubex/mihomo/common/net"
|
||||||
"github.com/Dreamacro/clash/component/ca"
|
"github.com/metacubex/mihomo/component/ca"
|
||||||
"github.com/Dreamacro/clash/component/dialer"
|
"github.com/metacubex/mihomo/component/dialer"
|
||||||
"github.com/Dreamacro/clash/component/proxydialer"
|
"github.com/metacubex/mihomo/component/proxydialer"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Http struct {
|
type Http struct {
|
||||||
|
@ -14,17 +14,17 @@ import (
|
|||||||
"github.com/metacubex/quic-go/congestion"
|
"github.com/metacubex/quic-go/congestion"
|
||||||
M "github.com/sagernet/sing/common/metadata"
|
M "github.com/sagernet/sing/common/metadata"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/component/ca"
|
"github.com/metacubex/mihomo/component/ca"
|
||||||
"github.com/Dreamacro/clash/component/dialer"
|
"github.com/metacubex/mihomo/component/dialer"
|
||||||
"github.com/Dreamacro/clash/component/proxydialer"
|
"github.com/metacubex/mihomo/component/proxydialer"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
"github.com/Dreamacro/clash/log"
|
"github.com/metacubex/mihomo/log"
|
||||||
hyCongestion "github.com/Dreamacro/clash/transport/hysteria/congestion"
|
hyCongestion "github.com/metacubex/mihomo/transport/hysteria/congestion"
|
||||||
"github.com/Dreamacro/clash/transport/hysteria/core"
|
"github.com/metacubex/mihomo/transport/hysteria/core"
|
||||||
"github.com/Dreamacro/clash/transport/hysteria/obfs"
|
"github.com/metacubex/mihomo/transport/hysteria/obfs"
|
||||||
"github.com/Dreamacro/clash/transport/hysteria/pmtud_fix"
|
"github.com/metacubex/mihomo/transport/hysteria/pmtud_fix"
|
||||||
"github.com/Dreamacro/clash/transport/hysteria/transport"
|
"github.com/metacubex/mihomo/transport/hysteria/transport"
|
||||||
"github.com/Dreamacro/clash/transport/hysteria/utils"
|
"github.com/metacubex/mihomo/transport/hysteria/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -9,12 +9,12 @@ import (
|
|||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
CN "github.com/Dreamacro/clash/common/net"
|
CN "github.com/metacubex/mihomo/common/net"
|
||||||
"github.com/Dreamacro/clash/component/ca"
|
"github.com/metacubex/mihomo/component/ca"
|
||||||
"github.com/Dreamacro/clash/component/dialer"
|
"github.com/metacubex/mihomo/component/dialer"
|
||||||
"github.com/Dreamacro/clash/component/proxydialer"
|
"github.com/metacubex/mihomo/component/proxydialer"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
tuicCommon "github.com/Dreamacro/clash/transport/tuic/common"
|
tuicCommon "github.com/metacubex/mihomo/transport/tuic/common"
|
||||||
|
|
||||||
"github.com/metacubex/sing-quic/hysteria2"
|
"github.com/metacubex/sing-quic/hysteria2"
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ import (
|
|||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
tlsC "github.com/Dreamacro/clash/component/tls"
|
tlsC "github.com/metacubex/mihomo/component/tls"
|
||||||
|
|
||||||
"golang.org/x/crypto/curve25519"
|
"golang.org/x/crypto/curve25519"
|
||||||
)
|
)
|
||||||
|
@ -6,9 +6,9 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/common/buf"
|
"github.com/metacubex/mihomo/common/buf"
|
||||||
"github.com/Dreamacro/clash/component/dialer"
|
"github.com/metacubex/mihomo/component/dialer"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Reject struct {
|
type Reject struct {
|
||||||
|
@ -7,16 +7,16 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
N "github.com/Dreamacro/clash/common/net"
|
N "github.com/metacubex/mihomo/common/net"
|
||||||
"github.com/Dreamacro/clash/common/structure"
|
"github.com/metacubex/mihomo/common/structure"
|
||||||
"github.com/Dreamacro/clash/component/dialer"
|
"github.com/metacubex/mihomo/component/dialer"
|
||||||
"github.com/Dreamacro/clash/component/proxydialer"
|
"github.com/metacubex/mihomo/component/proxydialer"
|
||||||
"github.com/Dreamacro/clash/component/resolver"
|
"github.com/metacubex/mihomo/component/resolver"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
"github.com/Dreamacro/clash/transport/restls"
|
"github.com/metacubex/mihomo/transport/restls"
|
||||||
obfs "github.com/Dreamacro/clash/transport/simple-obfs"
|
obfs "github.com/metacubex/mihomo/transport/simple-obfs"
|
||||||
shadowtls "github.com/Dreamacro/clash/transport/sing-shadowtls"
|
shadowtls "github.com/metacubex/mihomo/transport/sing-shadowtls"
|
||||||
v2rayObfs "github.com/Dreamacro/clash/transport/v2ray-plugin"
|
v2rayObfs "github.com/metacubex/mihomo/transport/v2ray-plugin"
|
||||||
|
|
||||||
restlsC "github.com/3andne/restls-client-go"
|
restlsC "github.com/3andne/restls-client-go"
|
||||||
shadowsocks "github.com/metacubex/sing-shadowsocks2"
|
shadowsocks "github.com/metacubex/sing-shadowsocks2"
|
||||||
|
@ -7,16 +7,16 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
N "github.com/Dreamacro/clash/common/net"
|
N "github.com/metacubex/mihomo/common/net"
|
||||||
"github.com/Dreamacro/clash/component/dialer"
|
"github.com/metacubex/mihomo/component/dialer"
|
||||||
"github.com/Dreamacro/clash/component/proxydialer"
|
"github.com/metacubex/mihomo/component/proxydialer"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
"github.com/Dreamacro/clash/transport/shadowsocks/core"
|
"github.com/metacubex/mihomo/transport/shadowsocks/core"
|
||||||
"github.com/Dreamacro/clash/transport/shadowsocks/shadowaead"
|
"github.com/metacubex/mihomo/transport/shadowsocks/shadowaead"
|
||||||
"github.com/Dreamacro/clash/transport/shadowsocks/shadowstream"
|
"github.com/metacubex/mihomo/transport/shadowsocks/shadowstream"
|
||||||
"github.com/Dreamacro/clash/transport/socks5"
|
"github.com/metacubex/mihomo/transport/socks5"
|
||||||
"github.com/Dreamacro/clash/transport/ssr/obfs"
|
"github.com/metacubex/mihomo/transport/ssr/obfs"
|
||||||
"github.com/Dreamacro/clash/transport/ssr/protocol"
|
"github.com/metacubex/mihomo/transport/ssr/protocol"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ShadowSocksR struct {
|
type ShadowSocksR struct {
|
||||||
@ -125,7 +125,7 @@ func (ssr *ShadowSocksR) SupportWithDialer() C.NetWork {
|
|||||||
|
|
||||||
func NewShadowSocksR(option ShadowSocksROption) (*ShadowSocksR, error) {
|
func NewShadowSocksR(option ShadowSocksROption) (*ShadowSocksR, error) {
|
||||||
// SSR protocol compatibility
|
// SSR protocol compatibility
|
||||||
// https://github.com/Dreamacro/clash/pull/2056
|
// https://github.com/metacubex/mihomo/pull/2056
|
||||||
if option.Cipher == "none" {
|
if option.Cipher == "none" {
|
||||||
option.Cipher = "dummy"
|
option.Cipher = "dummy"
|
||||||
}
|
}
|
||||||
|
@ -5,11 +5,11 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
CN "github.com/Dreamacro/clash/common/net"
|
CN "github.com/metacubex/mihomo/common/net"
|
||||||
"github.com/Dreamacro/clash/component/dialer"
|
"github.com/metacubex/mihomo/component/dialer"
|
||||||
"github.com/Dreamacro/clash/component/proxydialer"
|
"github.com/metacubex/mihomo/component/proxydialer"
|
||||||
"github.com/Dreamacro/clash/component/resolver"
|
"github.com/metacubex/mihomo/component/resolver"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
|
|
||||||
mux "github.com/sagernet/sing-mux"
|
mux "github.com/sagernet/sing-mux"
|
||||||
E "github.com/sagernet/sing/common/exceptions"
|
E "github.com/sagernet/sing/common/exceptions"
|
||||||
|
@ -6,13 +6,13 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
N "github.com/Dreamacro/clash/common/net"
|
N "github.com/metacubex/mihomo/common/net"
|
||||||
"github.com/Dreamacro/clash/common/structure"
|
"github.com/metacubex/mihomo/common/structure"
|
||||||
"github.com/Dreamacro/clash/component/dialer"
|
"github.com/metacubex/mihomo/component/dialer"
|
||||||
"github.com/Dreamacro/clash/component/proxydialer"
|
"github.com/metacubex/mihomo/component/proxydialer"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
obfs "github.com/Dreamacro/clash/transport/simple-obfs"
|
obfs "github.com/metacubex/mihomo/transport/simple-obfs"
|
||||||
"github.com/Dreamacro/clash/transport/snell"
|
"github.com/metacubex/mihomo/transport/snell"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Snell struct {
|
type Snell struct {
|
||||||
|
@ -10,12 +10,12 @@ import (
|
|||||||
"net/netip"
|
"net/netip"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
N "github.com/Dreamacro/clash/common/net"
|
N "github.com/metacubex/mihomo/common/net"
|
||||||
"github.com/Dreamacro/clash/component/ca"
|
"github.com/metacubex/mihomo/component/ca"
|
||||||
"github.com/Dreamacro/clash/component/dialer"
|
"github.com/metacubex/mihomo/component/dialer"
|
||||||
"github.com/Dreamacro/clash/component/proxydialer"
|
"github.com/metacubex/mihomo/component/proxydialer"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
"github.com/Dreamacro/clash/transport/socks5"
|
"github.com/metacubex/mihomo/transport/socks5"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Socks5 struct {
|
type Socks5 struct {
|
||||||
|
@ -8,14 +8,14 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
N "github.com/Dreamacro/clash/common/net"
|
N "github.com/metacubex/mihomo/common/net"
|
||||||
"github.com/Dreamacro/clash/component/ca"
|
"github.com/metacubex/mihomo/component/ca"
|
||||||
"github.com/Dreamacro/clash/component/dialer"
|
"github.com/metacubex/mihomo/component/dialer"
|
||||||
"github.com/Dreamacro/clash/component/proxydialer"
|
"github.com/metacubex/mihomo/component/proxydialer"
|
||||||
tlsC "github.com/Dreamacro/clash/component/tls"
|
tlsC "github.com/metacubex/mihomo/component/tls"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
"github.com/Dreamacro/clash/transport/gun"
|
"github.com/metacubex/mihomo/transport/gun"
|
||||||
"github.com/Dreamacro/clash/transport/trojan"
|
"github.com/metacubex/mihomo/transport/trojan"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Trojan struct {
|
type Trojan struct {
|
||||||
|
@ -10,12 +10,12 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/component/ca"
|
"github.com/metacubex/mihomo/component/ca"
|
||||||
"github.com/Dreamacro/clash/component/dialer"
|
"github.com/metacubex/mihomo/component/dialer"
|
||||||
"github.com/Dreamacro/clash/component/proxydialer"
|
"github.com/metacubex/mihomo/component/proxydialer"
|
||||||
"github.com/Dreamacro/clash/component/resolver"
|
"github.com/metacubex/mihomo/component/resolver"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
"github.com/Dreamacro/clash/transport/tuic"
|
"github.com/metacubex/mihomo/transport/tuic"
|
||||||
|
|
||||||
"github.com/gofrs/uuid/v5"
|
"github.com/gofrs/uuid/v5"
|
||||||
"github.com/metacubex/quic-go"
|
"github.com/metacubex/quic-go"
|
||||||
|
@ -11,9 +11,9 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/component/resolver"
|
"github.com/metacubex/mihomo/component/resolver"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
"github.com/Dreamacro/clash/transport/socks5"
|
"github.com/metacubex/mihomo/transport/socks5"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -12,20 +12,20 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/common/convert"
|
"github.com/metacubex/mihomo/common/convert"
|
||||||
N "github.com/Dreamacro/clash/common/net"
|
N "github.com/metacubex/mihomo/common/net"
|
||||||
"github.com/Dreamacro/clash/common/utils"
|
"github.com/metacubex/mihomo/common/utils"
|
||||||
"github.com/Dreamacro/clash/component/ca"
|
"github.com/metacubex/mihomo/component/ca"
|
||||||
"github.com/Dreamacro/clash/component/dialer"
|
"github.com/metacubex/mihomo/component/dialer"
|
||||||
"github.com/Dreamacro/clash/component/proxydialer"
|
"github.com/metacubex/mihomo/component/proxydialer"
|
||||||
"github.com/Dreamacro/clash/component/resolver"
|
"github.com/metacubex/mihomo/component/resolver"
|
||||||
tlsC "github.com/Dreamacro/clash/component/tls"
|
tlsC "github.com/metacubex/mihomo/component/tls"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
"github.com/Dreamacro/clash/log"
|
"github.com/metacubex/mihomo/log"
|
||||||
"github.com/Dreamacro/clash/transport/gun"
|
"github.com/metacubex/mihomo/transport/gun"
|
||||||
"github.com/Dreamacro/clash/transport/socks5"
|
"github.com/metacubex/mihomo/transport/socks5"
|
||||||
"github.com/Dreamacro/clash/transport/vless"
|
"github.com/metacubex/mihomo/transport/vless"
|
||||||
"github.com/Dreamacro/clash/transport/vmess"
|
"github.com/metacubex/mihomo/transport/vmess"
|
||||||
|
|
||||||
vmessSing "github.com/metacubex/sing-vmess"
|
vmessSing "github.com/metacubex/sing-vmess"
|
||||||
"github.com/metacubex/sing-vmess/packetaddr"
|
"github.com/metacubex/sing-vmess/packetaddr"
|
||||||
|
@ -11,17 +11,17 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
N "github.com/Dreamacro/clash/common/net"
|
N "github.com/metacubex/mihomo/common/net"
|
||||||
"github.com/Dreamacro/clash/common/utils"
|
"github.com/metacubex/mihomo/common/utils"
|
||||||
"github.com/Dreamacro/clash/component/ca"
|
"github.com/metacubex/mihomo/component/ca"
|
||||||
"github.com/Dreamacro/clash/component/dialer"
|
"github.com/metacubex/mihomo/component/dialer"
|
||||||
"github.com/Dreamacro/clash/component/proxydialer"
|
"github.com/metacubex/mihomo/component/proxydialer"
|
||||||
"github.com/Dreamacro/clash/component/resolver"
|
"github.com/metacubex/mihomo/component/resolver"
|
||||||
tlsC "github.com/Dreamacro/clash/component/tls"
|
tlsC "github.com/metacubex/mihomo/component/tls"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
"github.com/Dreamacro/clash/ntp"
|
"github.com/metacubex/mihomo/ntp"
|
||||||
"github.com/Dreamacro/clash/transport/gun"
|
"github.com/metacubex/mihomo/transport/gun"
|
||||||
clashVMess "github.com/Dreamacro/clash/transport/vmess"
|
mihomoVMess "github.com/metacubex/mihomo/transport/vmess"
|
||||||
|
|
||||||
vmess "github.com/metacubex/sing-vmess"
|
vmess "github.com/metacubex/sing-vmess"
|
||||||
"github.com/metacubex/sing-vmess/packetaddr"
|
"github.com/metacubex/sing-vmess/packetaddr"
|
||||||
@ -105,7 +105,7 @@ func (v *Vmess) StreamConnContext(ctx context.Context, c net.Conn, metadata *C.M
|
|||||||
switch v.option.Network {
|
switch v.option.Network {
|
||||||
case "ws":
|
case "ws":
|
||||||
host, port, _ := net.SplitHostPort(v.addr)
|
host, port, _ := net.SplitHostPort(v.addr)
|
||||||
wsOpts := &clashVMess.WebsocketConfig{
|
wsOpts := &mihomoVMess.WebsocketConfig{
|
||||||
Host: host,
|
Host: host,
|
||||||
Port: port,
|
Port: port,
|
||||||
Path: v.option.WSOpts.Path,
|
Path: v.option.WSOpts.Path,
|
||||||
@ -141,12 +141,12 @@ func (v *Vmess) StreamConnContext(ctx context.Context, c net.Conn, metadata *C.M
|
|||||||
wsOpts.TLSConfig.ServerName = host
|
wsOpts.TLSConfig.ServerName = host
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
c, err = clashVMess.StreamWebsocketConn(ctx, c, wsOpts)
|
c, err = mihomoVMess.StreamWebsocketConn(ctx, c, wsOpts)
|
||||||
case "http":
|
case "http":
|
||||||
// readability first, so just copy default TLS logic
|
// readability first, so just copy default TLS logic
|
||||||
if v.option.TLS {
|
if v.option.TLS {
|
||||||
host, _, _ := net.SplitHostPort(v.addr)
|
host, _, _ := net.SplitHostPort(v.addr)
|
||||||
tlsOpts := &clashVMess.TLSConfig{
|
tlsOpts := &mihomoVMess.TLSConfig{
|
||||||
Host: host,
|
Host: host,
|
||||||
SkipCertVerify: v.option.SkipCertVerify,
|
SkipCertVerify: v.option.SkipCertVerify,
|
||||||
ClientFingerprint: v.option.ClientFingerprint,
|
ClientFingerprint: v.option.ClientFingerprint,
|
||||||
@ -157,24 +157,24 @@ func (v *Vmess) StreamConnContext(ctx context.Context, c net.Conn, metadata *C.M
|
|||||||
if v.option.ServerName != "" {
|
if v.option.ServerName != "" {
|
||||||
tlsOpts.Host = v.option.ServerName
|
tlsOpts.Host = v.option.ServerName
|
||||||
}
|
}
|
||||||
c, err = clashVMess.StreamTLSConn(ctx, c, tlsOpts)
|
c, err = mihomoVMess.StreamTLSConn(ctx, c, tlsOpts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
host, _, _ := net.SplitHostPort(v.addr)
|
host, _, _ := net.SplitHostPort(v.addr)
|
||||||
httpOpts := &clashVMess.HTTPConfig{
|
httpOpts := &mihomoVMess.HTTPConfig{
|
||||||
Host: host,
|
Host: host,
|
||||||
Method: v.option.HTTPOpts.Method,
|
Method: v.option.HTTPOpts.Method,
|
||||||
Path: v.option.HTTPOpts.Path,
|
Path: v.option.HTTPOpts.Path,
|
||||||
Headers: v.option.HTTPOpts.Headers,
|
Headers: v.option.HTTPOpts.Headers,
|
||||||
}
|
}
|
||||||
|
|
||||||
c = clashVMess.StreamHTTPConn(c, httpOpts)
|
c = mihomoVMess.StreamHTTPConn(c, httpOpts)
|
||||||
case "h2":
|
case "h2":
|
||||||
host, _, _ := net.SplitHostPort(v.addr)
|
host, _, _ := net.SplitHostPort(v.addr)
|
||||||
tlsOpts := clashVMess.TLSConfig{
|
tlsOpts := mihomoVMess.TLSConfig{
|
||||||
Host: host,
|
Host: host,
|
||||||
SkipCertVerify: v.option.SkipCertVerify,
|
SkipCertVerify: v.option.SkipCertVerify,
|
||||||
NextProtos: []string{"h2"},
|
NextProtos: []string{"h2"},
|
||||||
@ -186,24 +186,24 @@ func (v *Vmess) StreamConnContext(ctx context.Context, c net.Conn, metadata *C.M
|
|||||||
tlsOpts.Host = v.option.ServerName
|
tlsOpts.Host = v.option.ServerName
|
||||||
}
|
}
|
||||||
|
|
||||||
c, err = clashVMess.StreamTLSConn(ctx, c, &tlsOpts)
|
c, err = mihomoVMess.StreamTLSConn(ctx, c, &tlsOpts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
h2Opts := &clashVMess.H2Config{
|
h2Opts := &mihomoVMess.H2Config{
|
||||||
Hosts: v.option.HTTP2Opts.Host,
|
Hosts: v.option.HTTP2Opts.Host,
|
||||||
Path: v.option.HTTP2Opts.Path,
|
Path: v.option.HTTP2Opts.Path,
|
||||||
}
|
}
|
||||||
|
|
||||||
c, err = clashVMess.StreamH2Conn(c, h2Opts)
|
c, err = mihomoVMess.StreamH2Conn(c, h2Opts)
|
||||||
case "grpc":
|
case "grpc":
|
||||||
c, err = gun.StreamGunWithConn(c, v.gunTLSConfig, v.gunConfig, v.realityConfig)
|
c, err = gun.StreamGunWithConn(c, v.gunTLSConfig, v.gunConfig, v.realityConfig)
|
||||||
default:
|
default:
|
||||||
// handle TLS
|
// handle TLS
|
||||||
if v.option.TLS {
|
if v.option.TLS {
|
||||||
host, _, _ := net.SplitHostPort(v.addr)
|
host, _, _ := net.SplitHostPort(v.addr)
|
||||||
tlsOpts := &clashVMess.TLSConfig{
|
tlsOpts := &mihomoVMess.TLSConfig{
|
||||||
Host: host,
|
Host: host,
|
||||||
SkipCertVerify: v.option.SkipCertVerify,
|
SkipCertVerify: v.option.SkipCertVerify,
|
||||||
ClientFingerprint: v.option.ClientFingerprint,
|
ClientFingerprint: v.option.ClientFingerprint,
|
||||||
@ -215,7 +215,7 @@ func (v *Vmess) StreamConnContext(ctx context.Context, c net.Conn, metadata *C.M
|
|||||||
tlsOpts.Host = v.option.ServerName
|
tlsOpts.Host = v.option.ServerName
|
||||||
}
|
}
|
||||||
|
|
||||||
c, err = clashVMess.StreamTLSConn(ctx, c, tlsOpts)
|
c, err = mihomoVMess.StreamTLSConn(ctx, c, tlsOpts)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,13 +13,13 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
CN "github.com/Dreamacro/clash/common/net"
|
CN "github.com/metacubex/mihomo/common/net"
|
||||||
"github.com/Dreamacro/clash/component/dialer"
|
"github.com/metacubex/mihomo/component/dialer"
|
||||||
"github.com/Dreamacro/clash/component/proxydialer"
|
"github.com/metacubex/mihomo/component/proxydialer"
|
||||||
"github.com/Dreamacro/clash/component/resolver"
|
"github.com/metacubex/mihomo/component/resolver"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
"github.com/Dreamacro/clash/dns"
|
"github.com/metacubex/mihomo/dns"
|
||||||
"github.com/Dreamacro/clash/log"
|
"github.com/metacubex/mihomo/log"
|
||||||
|
|
||||||
wireguard "github.com/metacubex/sing-wireguard"
|
wireguard "github.com/metacubex/sing-wireguard"
|
||||||
|
|
||||||
|
@ -6,13 +6,13 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/adapter/outbound"
|
"github.com/metacubex/mihomo/adapter/outbound"
|
||||||
"github.com/Dreamacro/clash/common/callback"
|
"github.com/metacubex/mihomo/common/callback"
|
||||||
N "github.com/Dreamacro/clash/common/net"
|
N "github.com/metacubex/mihomo/common/net"
|
||||||
"github.com/Dreamacro/clash/common/utils"
|
"github.com/metacubex/mihomo/common/utils"
|
||||||
"github.com/Dreamacro/clash/component/dialer"
|
"github.com/metacubex/mihomo/component/dialer"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
"github.com/Dreamacro/clash/constant/provider"
|
"github.com/metacubex/mihomo/constant/provider"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Fallback struct {
|
type Fallback struct {
|
||||||
|
@ -7,14 +7,14 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/adapter/outbound"
|
"github.com/metacubex/mihomo/adapter/outbound"
|
||||||
"github.com/Dreamacro/clash/common/atomic"
|
"github.com/metacubex/mihomo/common/atomic"
|
||||||
"github.com/Dreamacro/clash/common/utils"
|
"github.com/metacubex/mihomo/common/utils"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
"github.com/Dreamacro/clash/constant/provider"
|
"github.com/metacubex/mihomo/constant/provider"
|
||||||
types "github.com/Dreamacro/clash/constant/provider"
|
types "github.com/metacubex/mihomo/constant/provider"
|
||||||
"github.com/Dreamacro/clash/log"
|
"github.com/metacubex/mihomo/log"
|
||||||
"github.com/Dreamacro/clash/tunnel"
|
"github.com/metacubex/mihomo/tunnel"
|
||||||
|
|
||||||
"github.com/dlclark/regexp2"
|
"github.com/dlclark/regexp2"
|
||||||
)
|
)
|
||||||
|
@ -9,14 +9,14 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/adapter/outbound"
|
"github.com/metacubex/mihomo/adapter/outbound"
|
||||||
"github.com/Dreamacro/clash/common/cache"
|
"github.com/metacubex/mihomo/common/cache"
|
||||||
"github.com/Dreamacro/clash/common/callback"
|
"github.com/metacubex/mihomo/common/callback"
|
||||||
N "github.com/Dreamacro/clash/common/net"
|
N "github.com/metacubex/mihomo/common/net"
|
||||||
"github.com/Dreamacro/clash/common/utils"
|
"github.com/metacubex/mihomo/common/utils"
|
||||||
"github.com/Dreamacro/clash/component/dialer"
|
"github.com/metacubex/mihomo/component/dialer"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
"github.com/Dreamacro/clash/constant/provider"
|
"github.com/metacubex/mihomo/constant/provider"
|
||||||
|
|
||||||
"golang.org/x/net/publicsuffix"
|
"golang.org/x/net/publicsuffix"
|
||||||
)
|
)
|
||||||
|
@ -5,12 +5,12 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/adapter/outbound"
|
"github.com/metacubex/mihomo/adapter/outbound"
|
||||||
"github.com/Dreamacro/clash/adapter/provider"
|
"github.com/metacubex/mihomo/adapter/provider"
|
||||||
"github.com/Dreamacro/clash/common/structure"
|
"github.com/metacubex/mihomo/common/structure"
|
||||||
"github.com/Dreamacro/clash/common/utils"
|
"github.com/metacubex/mihomo/common/utils"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
types "github.com/Dreamacro/clash/constant/provider"
|
types "github.com/metacubex/mihomo/constant/provider"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -3,11 +3,11 @@ package outboundgroup
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/Dreamacro/clash/adapter/outbound"
|
"github.com/metacubex/mihomo/adapter/outbound"
|
||||||
"github.com/Dreamacro/clash/component/dialer"
|
"github.com/metacubex/mihomo/component/dialer"
|
||||||
"github.com/Dreamacro/clash/component/proxydialer"
|
"github.com/metacubex/mihomo/component/proxydialer"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
"github.com/Dreamacro/clash/constant/provider"
|
"github.com/metacubex/mihomo/constant/provider"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Relay struct {
|
type Relay struct {
|
||||||
|
@ -5,10 +5,10 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/adapter/outbound"
|
"github.com/metacubex/mihomo/adapter/outbound"
|
||||||
"github.com/Dreamacro/clash/component/dialer"
|
"github.com/metacubex/mihomo/component/dialer"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
"github.com/Dreamacro/clash/constant/provider"
|
"github.com/metacubex/mihomo/constant/provider"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Selector struct {
|
type Selector struct {
|
||||||
|
@ -6,13 +6,13 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/adapter/outbound"
|
"github.com/metacubex/mihomo/adapter/outbound"
|
||||||
"github.com/Dreamacro/clash/common/callback"
|
"github.com/metacubex/mihomo/common/callback"
|
||||||
N "github.com/Dreamacro/clash/common/net"
|
N "github.com/metacubex/mihomo/common/net"
|
||||||
"github.com/Dreamacro/clash/common/singledo"
|
"github.com/metacubex/mihomo/common/singledo"
|
||||||
"github.com/Dreamacro/clash/component/dialer"
|
"github.com/metacubex/mihomo/component/dialer"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
"github.com/Dreamacro/clash/constant/provider"
|
"github.com/metacubex/mihomo/constant/provider"
|
||||||
)
|
)
|
||||||
|
|
||||||
type urlTestOption func(*URLTest)
|
type urlTestOption func(*URLTest)
|
||||||
|
@ -3,11 +3,11 @@ package adapter
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
tlsC "github.com/Dreamacro/clash/component/tls"
|
tlsC "github.com/metacubex/mihomo/component/tls"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/adapter/outbound"
|
"github.com/metacubex/mihomo/adapter/outbound"
|
||||||
"github.com/Dreamacro/clash/common/structure"
|
"github.com/metacubex/mihomo/common/structure"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
)
|
)
|
||||||
|
|
||||||
func ParseProxy(mapping map[string]any) (C.Proxy, error) {
|
func ParseProxy(mapping map[string]any) (C.Proxy, error) {
|
||||||
|
@ -6,12 +6,12 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/common/atomic"
|
"github.com/metacubex/mihomo/common/atomic"
|
||||||
"github.com/Dreamacro/clash/common/batch"
|
"github.com/metacubex/mihomo/common/batch"
|
||||||
"github.com/Dreamacro/clash/common/singledo"
|
"github.com/metacubex/mihomo/common/singledo"
|
||||||
"github.com/Dreamacro/clash/common/utils"
|
"github.com/metacubex/mihomo/common/utils"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
"github.com/Dreamacro/clash/log"
|
"github.com/metacubex/mihomo/log"
|
||||||
|
|
||||||
"github.com/dlclark/regexp2"
|
"github.com/dlclark/regexp2"
|
||||||
)
|
)
|
||||||
|
@ -5,11 +5,11 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/common/structure"
|
"github.com/metacubex/mihomo/common/structure"
|
||||||
"github.com/Dreamacro/clash/common/utils"
|
"github.com/metacubex/mihomo/common/utils"
|
||||||
"github.com/Dreamacro/clash/component/resource"
|
"github.com/metacubex/mihomo/component/resource"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
types "github.com/Dreamacro/clash/constant/provider"
|
types "github.com/metacubex/mihomo/constant/provider"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -10,15 +10,15 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/adapter"
|
"github.com/metacubex/mihomo/adapter"
|
||||||
"github.com/Dreamacro/clash/common/convert"
|
"github.com/metacubex/mihomo/common/convert"
|
||||||
"github.com/Dreamacro/clash/common/utils"
|
"github.com/metacubex/mihomo/common/utils"
|
||||||
clashHttp "github.com/Dreamacro/clash/component/http"
|
mihomoHttp "github.com/metacubex/mihomo/component/http"
|
||||||
"github.com/Dreamacro/clash/component/resource"
|
"github.com/metacubex/mihomo/component/resource"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
types "github.com/Dreamacro/clash/constant/provider"
|
types "github.com/metacubex/mihomo/constant/provider"
|
||||||
"github.com/Dreamacro/clash/log"
|
"github.com/metacubex/mihomo/log"
|
||||||
"github.com/Dreamacro/clash/tunnel/statistic"
|
"github.com/metacubex/mihomo/tunnel/statistic"
|
||||||
|
|
||||||
"github.com/dlclark/regexp2"
|
"github.com/dlclark/regexp2"
|
||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
@ -119,8 +119,8 @@ func (pp *proxySetProvider) getSubscriptionInfo() {
|
|||||||
go func() {
|
go func() {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*90)
|
ctx, cancel := context.WithTimeout(context.Background(), time.Second*90)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
resp, err := clashHttp.HttpRequest(ctx, pp.Vehicle().(*resource.HTTPVehicle).Url(),
|
resp, err := mihomoHttp.HttpRequest(ctx, pp.Vehicle().(*resource.HTTPVehicle).Url(),
|
||||||
http.MethodGet, http.Header{"User-Agent": {"clash"}}, nil)
|
http.MethodGet, http.Header{"User-Agent": {"mihomo"}}, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -128,7 +128,7 @@ func (pp *proxySetProvider) getSubscriptionInfo() {
|
|||||||
|
|
||||||
userInfoStr := strings.TrimSpace(resp.Header.Get("subscription-userinfo"))
|
userInfoStr := strings.TrimSpace(resp.Header.Get("subscription-userinfo"))
|
||||||
if userInfoStr == "" {
|
if userInfoStr == "" {
|
||||||
resp2, err := clashHttp.HttpRequest(ctx, pp.Vehicle().(*resource.HTTPVehicle).Url(),
|
resp2, err := mihomoHttp.HttpRequest(ctx, pp.Vehicle().(*resource.HTTPVehicle).Url(),
|
||||||
http.MethodGet, http.Header{"User-Agent": {"Quantumultx"}}, nil)
|
http.MethodGet, http.Header{"User-Agent": {"Quantumultx"}}, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
|
2
common/cache/lrucache.go
vendored
2
common/cache/lrucache.go
vendored
@ -6,7 +6,7 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/common/generics/list"
|
"github.com/metacubex/mihomo/common/generics/list"
|
||||||
|
|
||||||
"github.com/samber/lo"
|
"github.com/samber/lo"
|
||||||
)
|
)
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package callback
|
package callback
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Dreamacro/clash/common/buf"
|
"github.com/metacubex/mihomo/common/buf"
|
||||||
N "github.com/Dreamacro/clash/common/net"
|
N "github.com/metacubex/mihomo/common/net"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
)
|
)
|
||||||
|
|
||||||
type firstWriteCallBackConn struct {
|
type firstWriteCallBackConn struct {
|
||||||
|
@ -9,10 +9,10 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/log"
|
"github.com/metacubex/mihomo/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ConvertsV2Ray convert V2Ray subscribe proxies data to clash proxies config
|
// ConvertsV2Ray convert V2Ray subscribe proxies data to mihomo proxies config
|
||||||
func ConvertsV2Ray(buf []byte) ([]map[string]any, error) {
|
func ConvertsV2Ray(buf []byte) ([]map[string]any, error) {
|
||||||
data := DecodeBase64(buf)
|
data := DecodeBase64(buf)
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/common/utils"
|
"github.com/metacubex/mihomo/common/utils"
|
||||||
|
|
||||||
"github.com/metacubex/sing-shadowsocks/shadowimpl"
|
"github.com/metacubex/sing-shadowsocks/shadowimpl"
|
||||||
"github.com/zhangyunhao116/fastrand"
|
"github.com/zhangyunhao116/fastrand"
|
||||||
|
@ -4,7 +4,7 @@ import (
|
|||||||
"bufio"
|
"bufio"
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/common/buf"
|
"github.com/metacubex/mihomo/common/buf"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ ExtendedConn = (*BufferedConn)(nil)
|
var _ ExtendedConn = (*BufferedConn)(nil)
|
||||||
|
@ -3,7 +3,7 @@ package net
|
|||||||
import (
|
import (
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/common/buf"
|
"github.com/metacubex/mihomo/common/buf"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ ExtendedConn = (*CachedConn)(nil)
|
var _ ExtendedConn = (*CachedConn)(nil)
|
||||||
|
@ -6,8 +6,8 @@ import (
|
|||||||
"runtime"
|
"runtime"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/common/atomic"
|
"github.com/metacubex/mihomo/common/atomic"
|
||||||
"github.com/Dreamacro/clash/common/net/packet"
|
"github.com/metacubex/mihomo/common/net/packet"
|
||||||
)
|
)
|
||||||
|
|
||||||
type readResult struct {
|
type readResult struct {
|
||||||
|
@ -5,7 +5,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/common/net/packet"
|
"github.com/metacubex/mihomo/common/net/packet"
|
||||||
)
|
)
|
||||||
|
|
||||||
type EnhancePacketConn struct {
|
type EnhancePacketConn struct {
|
||||||
|
@ -4,7 +4,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/common/net/packet"
|
"github.com/metacubex/mihomo/common/net/packet"
|
||||||
"github.com/sagernet/sing/common/buf"
|
"github.com/sagernet/sing/common/buf"
|
||||||
"github.com/sagernet/sing/common/bufio"
|
"github.com/sagernet/sing/common/bufio"
|
||||||
M "github.com/sagernet/sing/common/metadata"
|
M "github.com/sagernet/sing/common/metadata"
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package net
|
package net
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Dreamacro/clash/common/net/deadline"
|
"github.com/metacubex/mihomo/common/net/deadline"
|
||||||
"github.com/Dreamacro/clash/common/net/packet"
|
"github.com/metacubex/mihomo/common/net/packet"
|
||||||
)
|
)
|
||||||
|
|
||||||
type EnhancePacketConn = packet.EnhancePacketConn
|
type EnhancePacketConn = packet.EnhancePacketConn
|
||||||
|
@ -3,7 +3,7 @@ package packet
|
|||||||
import (
|
import (
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/common/pool"
|
"github.com/metacubex/mihomo/common/pool"
|
||||||
)
|
)
|
||||||
|
|
||||||
type WaitReadFrom interface {
|
type WaitReadFrom interface {
|
||||||
|
@ -7,7 +7,7 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/common/pool"
|
"github.com/metacubex/mihomo/common/pool"
|
||||||
)
|
)
|
||||||
|
|
||||||
type enhanceUDPConn struct {
|
type enhanceUDPConn struct {
|
||||||
|
@ -5,7 +5,7 @@ import (
|
|||||||
"runtime"
|
"runtime"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/common/buf"
|
"github.com/metacubex/mihomo/common/buf"
|
||||||
)
|
)
|
||||||
|
|
||||||
type refConn struct {
|
type refConn struct {
|
||||||
|
@ -12,7 +12,7 @@ package net
|
|||||||
//
|
//
|
||||||
// go func() {
|
// go func() {
|
||||||
// // Wrapping to avoid using *net.TCPConn.(ReadFrom)
|
// // Wrapping to avoid using *net.TCPConn.(ReadFrom)
|
||||||
// // See also https://github.com/Dreamacro/clash/pull/1209
|
// // See also https://github.com/metacubex/mihomo/pull/1209
|
||||||
// _, err := io.Copy(WriteOnlyWriter{Writer: leftConn}, ReadOnlyReader{Reader: rightConn})
|
// _, err := io.Copy(WriteOnlyWriter{Writer: leftConn}, ReadOnlyReader{Reader: rightConn})
|
||||||
// leftConn.SetReadDeadline(time.Now())
|
// leftConn.SetReadDeadline(time.Now())
|
||||||
// ch <- err
|
// ch <- err
|
||||||
|
@ -5,7 +5,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/common/atomic"
|
"github.com/metacubex/mihomo/common/atomic"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
@ -5,7 +5,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/common/atomic"
|
"github.com/metacubex/mihomo/common/atomic"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
@ -5,7 +5,7 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/component/dialer"
|
"github.com/metacubex/mihomo/component/dialer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func ListenDHCPClient(ctx context.Context, ifaceName string) (net.PacketConn, error) {
|
func ListenDHCPClient(ctx context.Context, ifaceName string) (net.PacketConn, error) {
|
||||||
|
@ -6,8 +6,8 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"net/netip"
|
"net/netip"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/common/nnip"
|
"github.com/metacubex/mihomo/common/nnip"
|
||||||
"github.com/Dreamacro/clash/component/iface"
|
"github.com/metacubex/mihomo/component/iface"
|
||||||
|
|
||||||
"github.com/insomniacslk/dhcp/dhcpv4"
|
"github.com/insomniacslk/dhcp/dhcpv4"
|
||||||
)
|
)
|
||||||
|
@ -6,7 +6,7 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/component/iface"
|
"github.com/metacubex/mihomo/component/iface"
|
||||||
)
|
)
|
||||||
|
|
||||||
func LookupLocalAddrFromIfaceName(ifaceName string, network string, destination netip.Addr, port int) (net.Addr, error) {
|
func LookupLocalAddrFromIfaceName(ifaceName string, network string, destination netip.Addr, port int) (net.Addr, error) {
|
||||||
|
@ -6,7 +6,7 @@ import (
|
|||||||
"net/netip"
|
"net/netip"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/component/iface"
|
"github.com/metacubex/mihomo/component/iface"
|
||||||
|
|
||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
)
|
)
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/component/iface"
|
"github.com/metacubex/mihomo/component/iface"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/component/resolver"
|
"github.com/metacubex/mihomo/component/resolver"
|
||||||
)
|
)
|
||||||
|
|
||||||
type dialFunc func(ctx context.Context, network string, ips []netip.Addr, port string, opt *option) (net.Conn, error)
|
type dialFunc func(ctx context.Context, network string, ips []netip.Addr, port string, opt *option) (net.Conn, error)
|
||||||
|
@ -7,7 +7,7 @@ import (
|
|||||||
"net/netip"
|
"net/netip"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/log"
|
"github.com/metacubex/mihomo/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
var printMarkWarnOnce sync.Once
|
var printMarkWarnOnce sync.Once
|
||||||
|
@ -4,8 +4,8 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/common/atomic"
|
"github.com/metacubex/mihomo/common/atomic"
|
||||||
"github.com/Dreamacro/clash/component/resolver"
|
"github.com/metacubex/mihomo/component/resolver"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -173,7 +173,7 @@ static __always_inline bool is_lan_ip(__be32 addr) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SEC("tc_clash_auto_redir_ingress")
|
SEC("tc_mihomo_auto_redir_ingress")
|
||||||
int tc_redir_ingress_func(struct __sk_buff *skb) {
|
int tc_redir_ingress_func(struct __sk_buff *skb) {
|
||||||
void *data = (void *)(long)skb->data;
|
void *data = (void *)(long)skb->data;
|
||||||
void *data_end = (void *)(long)skb->data_end;
|
void *data_end = (void *)(long)skb->data_end;
|
||||||
@ -264,7 +264,7 @@ int tc_redir_ingress_func(struct __sk_buff *skb) {
|
|||||||
return TC_ACT_OK;
|
return TC_ACT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
SEC("tc_clash_auto_redir_egress")
|
SEC("tc_mihomo_auto_redir_egress")
|
||||||
int tc_redir_egress_func(struct __sk_buff *skb) {
|
int tc_redir_egress_func(struct __sk_buff *skb) {
|
||||||
void *data = (void *)(long)skb->data;
|
void *data = (void *)(long)skb->data;
|
||||||
void *data_end = (void *)(long)skb->data_end;
|
void *data_end = (void *)(long)skb->data_end;
|
||||||
@ -276,10 +276,10 @@ int tc_redir_egress_func(struct __sk_buff *skb) {
|
|||||||
if (eth->h_proto != bpf_htons(ETH_P_IP))
|
if (eth->h_proto != bpf_htons(ETH_P_IP))
|
||||||
return TC_ACT_OK;
|
return TC_ACT_OK;
|
||||||
|
|
||||||
__u32 key = 0, *redir_ip, *redir_port; // *clash_mark
|
__u32 key = 0, *redir_ip, *redir_port; // *mihomo_mark
|
||||||
|
|
||||||
// clash_mark = bpf_map_lookup_elem(&redir_params_map, &key);
|
// mihomo_mark = bpf_map_lookup_elem(&redir_params_map, &key);
|
||||||
// if (clash_mark && *clash_mark != 0 && *clash_mark == skb->mark)
|
// if (mihomo_mark && *mihomo_mark != 0 && *mihomo_mark == skb->mark)
|
||||||
// return TC_ACT_OK;
|
// return TC_ACT_OK;
|
||||||
|
|
||||||
struct iphdr *iph = (struct iphdr *)(eth + 1);
|
struct iphdr *iph = (struct iphdr *)(eth + 1);
|
||||||
|
@ -38,7 +38,7 @@ static __always_inline bool is_lan_ip(__be32 addr) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SEC("tc_clash_redirect_to_tun")
|
SEC("tc_mihomo_redirect_to_tun")
|
||||||
int tc_tun_func(struct __sk_buff *skb) {
|
int tc_tun_func(struct __sk_buff *skb) {
|
||||||
void *data = (void *)(long)skb->data;
|
void *data = (void *)(long)skb->data;
|
||||||
void *data_end = (void *)(long)skb->data_end;
|
void *data_end = (void *)(long)skb->data_end;
|
||||||
@ -50,13 +50,13 @@ int tc_tun_func(struct __sk_buff *skb) {
|
|||||||
if (eth->h_proto == bpf_htons(ETH_P_ARP))
|
if (eth->h_proto == bpf_htons(ETH_P_ARP))
|
||||||
return TC_ACT_OK;
|
return TC_ACT_OK;
|
||||||
|
|
||||||
__u32 key = 0, *clash_mark, *tun_ifindex;
|
__u32 key = 0, *mihomo_mark, *tun_ifindex;
|
||||||
|
|
||||||
clash_mark = bpf_map_lookup_elem(&tc_params_map, &key);
|
mihomo_mark = bpf_map_lookup_elem(&tc_params_map, &key);
|
||||||
if (!clash_mark)
|
if (!mihomo_mark)
|
||||||
return TC_ACT_OK;
|
return TC_ACT_OK;
|
||||||
|
|
||||||
if (skb->mark == *clash_mark)
|
if (skb->mark == *mihomo_mark)
|
||||||
return TC_ACT_OK;
|
return TC_ACT_OK;
|
||||||
|
|
||||||
if (eth->h_proto == bpf_htons(ETH_P_IP)) {
|
if (eth->h_proto == bpf_htons(ETH_P_IP)) {
|
||||||
|
@ -3,8 +3,8 @@ package ebpf
|
|||||||
import (
|
import (
|
||||||
"net/netip"
|
"net/netip"
|
||||||
|
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
"github.com/Dreamacro/clash/transport/socks5"
|
"github.com/metacubex/mihomo/transport/socks5"
|
||||||
)
|
)
|
||||||
|
|
||||||
type TcEBpfProgram struct {
|
type TcEBpfProgram struct {
|
||||||
|
@ -6,11 +6,11 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net/netip"
|
"net/netip"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/common/cmd"
|
"github.com/metacubex/mihomo/common/cmd"
|
||||||
"github.com/Dreamacro/clash/component/dialer"
|
"github.com/metacubex/mihomo/component/dialer"
|
||||||
"github.com/Dreamacro/clash/component/ebpf/redir"
|
"github.com/metacubex/mihomo/component/ebpf/redir"
|
||||||
"github.com/Dreamacro/clash/component/ebpf/tc"
|
"github.com/metacubex/mihomo/component/ebpf/tc"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
"github.com/sagernet/netlink"
|
"github.com/sagernet/netlink"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ func NewTcEBpfProgram(ifaceNames []string, tunName string) (*TcEBpfProgram, erro
|
|||||||
|
|
||||||
tunIndex := uint32(tunIface.Attrs().Index)
|
tunIndex := uint32(tunIface.Attrs().Index)
|
||||||
|
|
||||||
dialer.DefaultRoutingMark.Store(C.ClashTrafficMark)
|
dialer.DefaultRoutingMark.Store(C.MihomoTrafficMark)
|
||||||
|
|
||||||
ifMark := uint32(dialer.DefaultRoutingMark.Load())
|
ifMark := uint32(dialer.DefaultRoutingMark.Load())
|
||||||
|
|
||||||
|
@ -16,9 +16,9 @@ import (
|
|||||||
"github.com/sagernet/netlink"
|
"github.com/sagernet/netlink"
|
||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/component/ebpf/byteorder"
|
"github.com/metacubex/mihomo/component/ebpf/byteorder"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
"github.com/Dreamacro/clash/transport/socks5"
|
"github.com/metacubex/mihomo/transport/socks5"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:generate go run github.com/cilium/ebpf/cmd/bpf2go -cc $BPF_CLANG -cflags $BPF_CFLAGS bpf ../bpf/redir.c
|
//go:generate go run github.com/cilium/ebpf/cmd/bpf2go -cc $BPF_CLANG -cflags $BPF_CFLAGS bpf ../bpf/redir.c
|
||||||
@ -131,7 +131,7 @@ func (e *EBpfRedirect) Start() error {
|
|||||||
filter := &netlink.BpfFilter{
|
filter := &netlink.BpfFilter{
|
||||||
FilterAttrs: filterAttrs,
|
FilterAttrs: filterAttrs,
|
||||||
Fd: objs.bpfPrograms.TcRedirIngressFunc.FD(),
|
Fd: objs.bpfPrograms.TcRedirIngressFunc.FD(),
|
||||||
Name: "clash-redir-ingress-" + e.ifName,
|
Name: "mihomo-redir-ingress-" + e.ifName,
|
||||||
DirectAction: true,
|
DirectAction: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ func (e *EBpfRedirect) Start() error {
|
|||||||
filterEgress := &netlink.BpfFilter{
|
filterEgress := &netlink.BpfFilter{
|
||||||
FilterAttrs: filterAttrsEgress,
|
FilterAttrs: filterAttrsEgress,
|
||||||
Fd: objs.bpfPrograms.TcRedirEgressFunc.FD(),
|
Fd: objs.bpfPrograms.TcRedirEgressFunc.FD(),
|
||||||
Name: "clash-redir-egress-" + e.ifName,
|
Name: "mihomo-redir-egress-" + e.ifName,
|
||||||
DirectAction: true,
|
DirectAction: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,8 +14,8 @@ import (
|
|||||||
"github.com/sagernet/netlink"
|
"github.com/sagernet/netlink"
|
||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
|
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
"github.com/Dreamacro/clash/transport/socks5"
|
"github.com/metacubex/mihomo/transport/socks5"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:generate go run github.com/cilium/ebpf/cmd/bpf2go -cc $BPF_CLANG -cflags $BPF_CFLAGS bpf ../bpf/tc.c
|
//go:generate go run github.com/cilium/ebpf/cmd/bpf2go -cc $BPF_CLANG -cflags $BPF_CFLAGS bpf ../bpf/tc.c
|
||||||
@ -115,7 +115,7 @@ func (e *EBpfTC) Start() error {
|
|||||||
filter := &netlink.BpfFilter{
|
filter := &netlink.BpfFilter{
|
||||||
FilterAttrs: filterAttrs,
|
FilterAttrs: filterAttrs,
|
||||||
Fd: objs.bpfPrograms.TcTunFunc.FD(),
|
Fd: objs.bpfPrograms.TcTunFunc.FD(),
|
||||||
Name: "clash-tc-" + e.ifName,
|
Name: "mihomo-tc-" + e.ifName,
|
||||||
DirectAction: true,
|
DirectAction: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ package fakeip
|
|||||||
import (
|
import (
|
||||||
"net/netip"
|
"net/netip"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/component/profile/cachefile"
|
"github.com/metacubex/mihomo/component/profile/cachefile"
|
||||||
)
|
)
|
||||||
|
|
||||||
type cachefileStore struct {
|
type cachefileStore struct {
|
||||||
|
@ -3,7 +3,7 @@ package fakeip
|
|||||||
import (
|
import (
|
||||||
"net/netip"
|
"net/netip"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/common/cache"
|
"github.com/metacubex/mihomo/common/cache"
|
||||||
)
|
)
|
||||||
|
|
||||||
type memoryStore struct {
|
type memoryStore struct {
|
||||||
|
@ -6,9 +6,9 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/common/nnip"
|
"github.com/metacubex/mihomo/common/nnip"
|
||||||
"github.com/Dreamacro/clash/component/profile/cachefile"
|
"github.com/metacubex/mihomo/component/profile/cachefile"
|
||||||
"github.com/Dreamacro/clash/component/trie"
|
"github.com/metacubex/mihomo/component/trie"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -7,8 +7,8 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/component/profile/cachefile"
|
"github.com/metacubex/mihomo/component/profile/cachefile"
|
||||||
"github.com/Dreamacro/clash/component/trie"
|
"github.com/metacubex/mihomo/component/trie"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"go.etcd.io/bbolt"
|
"go.etcd.io/bbolt"
|
||||||
@ -32,7 +32,7 @@ func createCachefileStore(options Options) (*Pool, string, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, "", err
|
return nil, "", err
|
||||||
}
|
}
|
||||||
f, err := os.CreateTemp("", "clash")
|
f, err := os.CreateTemp("", "mihomo")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, "", err
|
return nil, "", err
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ package geodata
|
|||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/component/geodata/router"
|
"github.com/metacubex/mihomo/component/geodata/router"
|
||||||
)
|
)
|
||||||
|
|
||||||
type AttributeList struct {
|
type AttributeList struct {
|
||||||
|
@ -3,8 +3,8 @@ package geodata
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/component/geodata/router"
|
"github.com/metacubex/mihomo/component/geodata/router"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
)
|
)
|
||||||
|
|
||||||
type loader struct {
|
type loader struct {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package geodata
|
package geodata
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Dreamacro/clash/component/geodata/router"
|
"github.com/metacubex/mihomo/component/geodata/router"
|
||||||
)
|
)
|
||||||
|
|
||||||
type LoaderImplementation interface {
|
type LoaderImplementation interface {
|
||||||
|
@ -8,10 +8,10 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
clashHttp "github.com/Dreamacro/clash/component/http"
|
mihomoHttp "github.com/metacubex/mihomo/component/http"
|
||||||
"github.com/Dreamacro/clash/component/mmdb"
|
"github.com/metacubex/mihomo/component/mmdb"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
"github.com/Dreamacro/clash/log"
|
"github.com/metacubex/mihomo/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
var initGeoSite bool
|
var initGeoSite bool
|
||||||
@ -44,7 +44,7 @@ func InitGeoSite() error {
|
|||||||
func downloadGeoSite(path string) (err error) {
|
func downloadGeoSite(path string) (err error) {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*90)
|
ctx, cancel := context.WithTimeout(context.Background(), time.Second*90)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
resp, err := clashHttp.HttpRequest(ctx, C.GeoSiteUrl, http.MethodGet, http.Header{"User-Agent": {"clash"}}, nil)
|
resp, err := mihomoHttp.HttpRequest(ctx, C.GeoSiteUrl, http.MethodGet, http.Header{"User-Agent": {"mihomo"}}, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -63,7 +63,7 @@ func downloadGeoSite(path string) (err error) {
|
|||||||
func downloadGeoIP(path string) (err error) {
|
func downloadGeoIP(path string) (err error) {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*90)
|
ctx, cancel := context.WithTimeout(context.Background(), time.Second*90)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
resp, err := clashHttp.HttpRequest(ctx, C.GeoIpUrl, http.MethodGet, http.Header{"User-Agent": {"clash"}}, nil)
|
resp, err := mihomoHttp.HttpRequest(ctx, C.GeoIpUrl, http.MethodGet, http.Header{"User-Agent": {"mihomo"}}, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -5,9 +5,9 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/component/geodata/router"
|
"github.com/metacubex/mihomo/component/geodata/router"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
"github.com/Dreamacro/clash/log"
|
"github.com/metacubex/mihomo/log"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -5,8 +5,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/component/geodata"
|
"github.com/metacubex/mihomo/component/geodata"
|
||||||
"github.com/Dreamacro/clash/component/geodata/router"
|
"github.com/metacubex/mihomo/component/geodata/router"
|
||||||
)
|
)
|
||||||
|
|
||||||
type memConservativeLoader struct {
|
type memConservativeLoader struct {
|
||||||
|
@ -7,7 +7,7 @@ import (
|
|||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/component/geodata/strmatcher"
|
"github.com/metacubex/mihomo/component/geodata/strmatcher"
|
||||||
)
|
)
|
||||||
|
|
||||||
var matcherTypeMap = map[Domain_Type]strmatcher.Type{
|
var matcherTypeMap = map[Domain_Type]strmatcher.Type{
|
||||||
|
@ -84,7 +84,7 @@ type Domain struct {
|
|||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
// Domain matching type.
|
// Domain matching type.
|
||||||
Type Domain_Type `protobuf:"varint,1,opt,name=type,proto3,enum=clash.component.geodata.router.Domain_Type" json:"type,omitempty"`
|
Type Domain_Type `protobuf:"varint,1,opt,name=type,proto3,enum=mihomo.component.geodata.router.Domain_Type" json:"type,omitempty"`
|
||||||
// Domain value.
|
// Domain value.
|
||||||
Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
|
Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
|
||||||
// Attributes of this domain. May be used for filtering.
|
// Attributes of this domain. May be used for filtering.
|
||||||
@ -585,22 +585,22 @@ func file_component_geodata_router_config_proto_rawDescGZIP() []byte {
|
|||||||
var file_component_geodata_router_config_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
var file_component_geodata_router_config_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||||
var file_component_geodata_router_config_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
|
var file_component_geodata_router_config_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
|
||||||
var file_component_geodata_router_config_proto_goTypes = []interface{}{
|
var file_component_geodata_router_config_proto_goTypes = []interface{}{
|
||||||
(Domain_Type)(0), // 0: clash.component.geodata.router.Domain.Type
|
(Domain_Type)(0), // 0: mihomo.component.geodata.router.Domain.Type
|
||||||
(*Domain)(nil), // 1: clash.component.geodata.router.Domain
|
(*Domain)(nil), // 1: mihomo.component.geodata.router.Domain
|
||||||
(*CIDR)(nil), // 2: clash.component.geodata.router.CIDR
|
(*CIDR)(nil), // 2: mihomo.component.geodata.router.CIDR
|
||||||
(*GeoIP)(nil), // 3: clash.component.geodata.router.GeoIP
|
(*GeoIP)(nil), // 3: mihomo.component.geodata.router.GeoIP
|
||||||
(*GeoIPList)(nil), // 4: clash.component.geodata.router.GeoIPList
|
(*GeoIPList)(nil), // 4: mihomo.component.geodata.router.GeoIPList
|
||||||
(*GeoSite)(nil), // 5: clash.component.geodata.router.GeoSite
|
(*GeoSite)(nil), // 5: mihomo.component.geodata.router.GeoSite
|
||||||
(*GeoSiteList)(nil), // 6: clash.component.geodata.router.GeoSiteList
|
(*GeoSiteList)(nil), // 6: mihomo.component.geodata.router.GeoSiteList
|
||||||
(*Domain_Attribute)(nil), // 7: clash.component.geodata.router.Domain.Attribute
|
(*Domain_Attribute)(nil), // 7: mihomo.component.geodata.router.Domain.Attribute
|
||||||
}
|
}
|
||||||
var file_component_geodata_router_config_proto_depIdxs = []int32{
|
var file_component_geodata_router_config_proto_depIdxs = []int32{
|
||||||
0, // 0: clash.component.geodata.router.Domain.type:type_name -> clash.component.geodata.router.Domain.Type
|
0, // 0: mihomo.component.geodata.router.Domain.type:type_name -> mihomo.component.geodata.router.Domain.Type
|
||||||
7, // 1: clash.component.geodata.router.Domain.attribute:type_name -> clash.component.geodata.router.Domain.Attribute
|
7, // 1: mihomo.component.geodata.router.Domain.attribute:type_name -> mihomo.component.geodata.router.Domain.Attribute
|
||||||
2, // 2: clash.component.geodata.router.GeoIP.cidr:type_name -> clash.component.geodata.router.CIDR
|
2, // 2: mihomo.component.geodata.router.GeoIP.cidr:type_name -> mihomo.component.geodata.router.CIDR
|
||||||
3, // 3: clash.component.geodata.router.GeoIPList.entry:type_name -> clash.component.geodata.router.GeoIP
|
3, // 3: mihomo.component.geodata.router.GeoIPList.entry:type_name -> mihomo.component.geodata.router.GeoIP
|
||||||
1, // 4: clash.component.geodata.router.GeoSite.domain:type_name -> clash.component.geodata.router.Domain
|
1, // 4: mihomo.component.geodata.router.GeoSite.domain:type_name -> mihomo.component.geodata.router.Domain
|
||||||
5, // 5: clash.component.geodata.router.GeoSiteList.entry:type_name -> clash.component.geodata.router.GeoSite
|
5, // 5: mihomo.component.geodata.router.GeoSiteList.entry:type_name -> mihomo.component.geodata.router.GeoSite
|
||||||
6, // [6:6] is the sub-list for method output_type
|
6, // [6:6] is the sub-list for method output_type
|
||||||
6, // [6:6] is the sub-list for method input_type
|
6, // [6:6] is the sub-list for method input_type
|
||||||
6, // [6:6] is the sub-list for extension type_name
|
6, // [6:6] is the sub-list for extension type_name
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
||||||
package clash.component.geodata.router;
|
package mihomo.component.geodata.router;
|
||||||
option csharp_namespace = "Clash.Component.Geodata.Router";
|
option csharp_namespace = "Mihomo.Component.Geodata.Router";
|
||||||
option go_package = "github.com/Dreamacro/clash/component/geodata/router";
|
option go_package = "github.com/metacubex/mihomo/component/geodata/router";
|
||||||
option java_package = "com.clash.component.geodata.router";
|
option java_package = "com.mihomo.component.geodata.router";
|
||||||
option java_multiple_files = true;
|
option java_multiple_files = true;
|
||||||
|
|
||||||
// Domain for routing decision.
|
// Domain for routing decision.
|
||||||
|
@ -6,9 +6,9 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/component/geodata"
|
"github.com/metacubex/mihomo/component/geodata"
|
||||||
"github.com/Dreamacro/clash/component/geodata/router"
|
"github.com/metacubex/mihomo/component/geodata/router"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package strmatcher
|
package strmatcher
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Dreamacro/clash/common/generics/list"
|
"github.com/metacubex/mihomo/common/generics/list"
|
||||||
)
|
)
|
||||||
|
|
||||||
const validCharCount = 53
|
const validCharCount = 53
|
||||||
|
@ -6,9 +6,9 @@ import (
|
|||||||
"golang.org/x/sync/singleflight"
|
"golang.org/x/sync/singleflight"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/component/geodata/router"
|
"github.com/metacubex/mihomo/component/geodata/router"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
"github.com/Dreamacro/clash/log"
|
"github.com/metacubex/mihomo/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
var geoLoaderName = "memconservative"
|
var geoLoaderName = "memconservative"
|
||||||
|
@ -11,9 +11,9 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/component/ca"
|
"github.com/metacubex/mihomo/component/ca"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
"github.com/Dreamacro/clash/listener/inner"
|
"github.com/metacubex/mihomo/listener/inner"
|
||||||
)
|
)
|
||||||
|
|
||||||
func HttpRequest(ctx context.Context, url, method string, header map[string][]string, body io.Reader) (*http.Response, error) {
|
func HttpRequest(ctx context.Context, url, method string, header map[string][]string, body io.Reader) (*http.Response, error) {
|
||||||
|
@ -7,7 +7,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/common/singledo"
|
"github.com/metacubex/mihomo/common/singledo"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Interface struct {
|
type Interface struct {
|
||||||
|
@ -8,9 +8,9 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
clashHttp "github.com/Dreamacro/clash/component/http"
|
mihomoHttp "github.com/metacubex/mihomo/component/http"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
"github.com/Dreamacro/clash/log"
|
"github.com/metacubex/mihomo/log"
|
||||||
|
|
||||||
"github.com/oschwald/maxminddb-golang"
|
"github.com/oschwald/maxminddb-golang"
|
||||||
)
|
)
|
||||||
@ -79,7 +79,7 @@ func Instance() Reader {
|
|||||||
func DownloadMMDB(path string) (err error) {
|
func DownloadMMDB(path string) (err error) {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*90)
|
ctx, cancel := context.WithTimeout(context.Background(), time.Second*90)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
resp, err := clashHttp.HttpRequest(ctx, C.MmdbUrl, http.MethodGet, http.Header{"User-Agent": {"clash"}}, nil)
|
resp, err := mihomoHttp.HttpRequest(ctx, C.MmdbUrl, http.MethodGet, http.Header{"User-Agent": {"mihomo"}}, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,8 @@ package nat
|
|||||||
import (
|
import (
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/common/atomic"
|
"github.com/metacubex/mihomo/common/atomic"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
)
|
)
|
||||||
|
|
||||||
type writeBackProxy struct {
|
type writeBackProxy struct {
|
||||||
|
@ -4,7 +4,7 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/metacubex/mihomo/constant"
|
||||||
|
|
||||||
"github.com/puzpuzpuz/xsync/v2"
|
"github.com/puzpuzpuz/xsync/v2"
|
||||||
)
|
)
|
||||||
|
@ -10,8 +10,8 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/common/nnip"
|
"github.com/metacubex/mihomo/common/nnip"
|
||||||
"github.com/Dreamacro/clash/log"
|
"github.com/metacubex/mihomo/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
// store process name for when dealing with multiple PROCESS-NAME rules
|
// store process name for when dealing with multiple PROCESS-NAME rules
|
||||||
|
@ -7,8 +7,8 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/common/nnip"
|
"github.com/metacubex/mihomo/common/nnip"
|
||||||
"github.com/Dreamacro/clash/log"
|
"github.com/metacubex/mihomo/log"
|
||||||
|
|
||||||
"golang.org/x/sys/windows"
|
"golang.org/x/sys/windows"
|
||||||
)
|
)
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user