Skip to content

Commit

Permalink
v3.6.0 release
Browse files Browse the repository at this point in the history
1. Provide client API to third party applications like clash.meta (issue #161).
  • Loading branch information
enfein committed Oct 7, 2024
1 parent 252f966 commit d035bcc
Show file tree
Hide file tree
Showing 28 changed files with 313 additions and 100 deletions.
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ PROJECT_NAME=$(shell basename "${ROOT}")
# - pkg/version/current.go
#
# Use `tools/bump_version.sh` script to change all those files at one shot.
VERSION="3.5.1"
VERSION="3.6.0"

# Build binaries and installation packages.
.PHONY: build
Expand Down Expand Up @@ -353,6 +353,7 @@ test-binary:
CGO_ENABLED=0 go build -ldflags="-X 'github.com/enfein/mieru/pkg/log.LogPrefix=S'" -o mita cmd/mita/mita.go
CGO_ENABLED=1 go build -race -ldflags="-X 'github.com/enfein/mieru/pkg/log.LogPrefix=C2'" -o mieru2 cmd/mieru/mieru.go
CGO_ENABLED=1 go build -race -ldflags="-X 'github.com/enfein/mieru/pkg/log.LogPrefix=S2'" -o mita2 cmd/mita/mita.go
CGO_ENABLED=0 go build test/cmd/exampleapiclient/exampleapiclient.go
CGO_ENABLED=0 go build test/cmd/httpserver/httpserver.go
CGO_ENABLED=0 go build test/cmd/sockshttpclient/sockshttpclient.go
CGO_ENABLED=0 go build test/cmd/socksudpclient/socksudpclient.go
Expand All @@ -365,14 +366,14 @@ test-container: test-binary
docker build -t mieru_httptest:${SHORT_SHA} -f test/deploy/httptest/Dockerfile .;\
docker build -t mieru_proxychain:${SHORT_SHA} -f test/deploy/proxychain/Dockerfile .;\
fi
rm -f mieru mieru2 mita mita2 httpserver sockshttpclient socksudpclient udpserver
rm -f exampleapiclient mieru mieru2 mita mita2 httpserver sockshttpclient socksudpclient udpserver

# Run docker integration tests.
.PHONY: run-container-test
run-container-test: test-container
if [ ! -z $$(command -v docker) ]; then\
docker run mieru_proxychain:${SHORT_SHA};\
docker run mieru_httptest:${SHORT_SHA};\
docker run mieru_proxychain:${SHORT_SHA};\
fi

# Format source code.
Expand Down
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,12 @@ For an explanation of the mieru protocol, see [mieru Proxy Protocol](./docs/prot

## Features

1. mieru uses a high-strength XChaCha20-Poly1305 encryption algorithm that generates encryption keys based on username, password and system time.
1. mieru implements complete encryption of all transmitted content between the client and the proxy server, without transmitting any plaintext information.
1. When mieru sends a packet, it is padded with random bytes at the end. Even when the same content is transmitted, the packet size varies.
1. When using the UDP transport protocol, mieru does not require a handshake between client and server.
1. When the server can not decrypt the data sent by the client, no content is returned. it is difficult for GFW to discover the mieru service through active probing.
1. mieru supports multiple users sharing a single proxy server.
1. mieru supports IPv4 and IPv6.
1. mieru provides socks5, HTTP and HTTPS proxy.
1. Provides socks5, HTTP, and HTTPS proxy interfaces.
1. Does not use TLS protocol. No need to register a domain name or set up a fake website.
1. Uses the high-strength XChaCha20-Poly1305 encryption algorithm that generates encryption keys based on username, password and system time.
1. Utilizes random padding and replay attack detection to prevent GFW from detecting the mieru service.
1. Supports multiple users sharing a single proxy server.
1. Supports both IPv4 and IPv6.
1. The server software supports socks5 outbound (proxy chain).
1. The client software supports Windows, Mac OS, Linux and Android. Android clients include
- [NekoBox](https://github.com/MatsuriDayo/NekoBoxForAndroid) version 1.3.1 or above, with [mieru plugin](https://github.com/enfein/NekoBoxPlugins).
Expand Down
12 changes: 5 additions & 7 deletions README.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@ mieru 的翻墙原理与 shadowsocks / v2ray 等软件类似,在客户端和

## 特性

1. 提供 socks5, HTTP 和 HTTPS 代理接口。
1. 不使用 TLS 协议,无需注册域名和架设伪装站点。
1. 使用高强度的 XChaCha20-Poly1305 加密算法,基于用户名、密码和系统时间生成密钥。
1. mieru 实现了客户端和代理服务器之间所有传输内容的完整加密,不传输任何明文信息。
1. 当 mieru 发送数据包时,会在尾部填充随机信息。即便是传输相同的内容,数据包大小也不相同。
1. 在使用 UDP 传输协议时,mieru 不需要客户端和服务器进行握手,即可直接发送数据。
1. 当服务器无法解密客户端发送的数据时,不会返回任何内容。GFW 很难通过主动探测发现 mieru 服务。
1. mieru 支持多个用户共享代理服务器。
1. mieru 支持 IPv4 和 IPv6。
1. mieru 提供 socks5, HTTP 和 HTTPS 代理。
1. 使用随机填充与重放攻击检测阻止 GFW 探测 mieru 服务。
1. 支持多个用户共享代理服务器。
1. 支持 IPv4 和 IPv6。
1. 服务器软件支持 socks5 出站(链式代理)。
1. 客户端软件支持 Windows, Mac OS, Linux 和 Android 系统。Android 客户端包括
- [NekoBox](https://github.com/MatsuriDayo/NekoBoxForAndroid) 1.3.1 及以上版本,并安装 [mieru 插件](https://github.com/enfein/NekoBoxPlugins)
Expand Down
24 changes: 14 additions & 10 deletions apis/client/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ import (
)

var (
ErrNoClientConfig = errors.New("no client config")
ErrInvalidConfigConfig = errors.New("invalid client config")
ErrClientIsNotRunning = errors.New("client is not running")
ErrNoClientConfig = errors.New("no client config")
ErrInvalidConfigConfig = errors.New("invalid client config")
ErrClientIsNotRunning = errors.New("client is not running")
ErrStoreClientConfigAfterStart = errors.New("can't store client config after start")
)

// Client contains methods supported by a mieru client.
Expand All @@ -44,7 +45,7 @@ type ClientConfigurationService interface {
Load() (*ClientConfig, error)

// Store saves the client config.
// It returns wrapped ErrInvalidConfigConfig if client config is invalid.
// It returns wrapped ErrInvalidConfigConfig if the provided client config is invalid.
Store(*ClientConfig) error
}

Expand All @@ -64,16 +65,19 @@ type ClientLifecycleService interface {
IsRunning() bool
}

// ClientNetworkService contains methods to establish proxy connections.
// ClientNetworkService contains methods to establish connections to proxy server.
type ClientNetworkService interface {
// DialContext returns a new mieru connection to reach proxy server.
// DialContext returns a new proxy connection to reach proxy server.
// It returns an error if the client has not been started,
// or has been stopped.
DialContext(context.Context) (net.Conn, error)

// HandshakeWithConnect completes the socks5 CONNECT request with proxy server.
// After this, the mieru connection is able to send and receive user payload.
// The mieru connection is NOT terminated when an error is returned.
// HandshakeWithConnect completes the socks5 CONNECT request with proxy server
// in the given proxy connection.
// You may need to send a response back to the application that initiated
// the proxy connection.
// After that, the proxy connection is able to send and receive user payload.
// The proxy connection is NOT terminated when an error is returned.
HandshakeWithConnect(context.Context, net.Conn, model.AddrSpec) error
}

Expand All @@ -82,7 +86,7 @@ type ClientConfig struct {
Profile *appctlpb.ClientProfile
}

// NewClient returns a blank mieru client.
// NewClient creates a blank mieru client with no client config.
func NewClient() Client {
mc := &mieruClient{}
mc.initOnce()
Expand Down
5 changes: 4 additions & 1 deletion apis/client/mieru.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ func (mc *mieruClient) Store(config *ClientConfig) error {
if config.Profile == nil {
return fmt.Errorf("%w: client config profile is nil", ErrInvalidConfigConfig)
}
if mc.running {
return ErrStoreClientConfigAfterStart
}
if err := appctl.ValidateClientConfigSingleProfile(config.Profile); err != nil {
return fmt.Errorf("%w: %s", ErrInvalidConfigConfig, err.Error())
}
Expand Down Expand Up @@ -120,7 +123,7 @@ func (mc *mieruClient) Start() error {
}
mc.mux = mc.mux.SetClientMultiplexFactor(multiplexFactor)

// Set endpoints.
// Set server endpoints.
mtu := util.DefaultMTU
if activeProfile.GetMtu() != 0 {
mtu = int(activeProfile.GetMtu())
Expand Down
12 changes: 12 additions & 0 deletions apis/constant/socks5.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,15 @@ const (
Socks5FQDNAddress byte = 3
Socks5IPv6Address byte = 4
)

// socks5 authentication options.
const (
Socks5NoAuth byte = 0
Socks5UserPassAuth byte = 2
Socks5NoAcceptableAuth byte = 255

Socks5UserPassAuthVersion byte = 1

Socks5AuthSuccess byte = 0
Socks5AuthFailure byte = 1
)
2 changes: 1 addition & 1 deletion build/package/mieru/amd64/debian/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: mieru
Version: 3.5.1
Version: 3.6.0
Section: net
Priority: optional
Architecture: amd64
Expand Down
2 changes: 1 addition & 1 deletion build/package/mieru/amd64/rpm/mieru.spec
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Name: mieru
Version: 3.5.1
Version: 3.6.0
Release: 1%{?dist}
Summary: Mieru proxy client
License: GPLv3+
Expand Down
2 changes: 1 addition & 1 deletion build/package/mieru/arm64/debian/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: mieru
Version: 3.5.1
Version: 3.6.0
Section: net
Priority: optional
Architecture: arm64
Expand Down
2 changes: 1 addition & 1 deletion build/package/mieru/arm64/rpm/mieru.spec
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Name: mieru
Version: 3.5.1
Version: 3.6.0
Release: 1%{?dist}
Summary: Mieru proxy client
License: GPLv3+
Expand Down
2 changes: 1 addition & 1 deletion build/package/mita/amd64/debian/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: mita
Version: 3.5.1
Version: 3.6.0
Section: net
Priority: optional
Architecture: amd64
Expand Down
2 changes: 1 addition & 1 deletion build/package/mita/amd64/rpm/mita.spec
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Name: mita
Version: 3.5.1
Version: 3.6.0
Release: 1%{?dist}
Summary: Mieru proxy server
License: GPLv3+
Expand Down
2 changes: 1 addition & 1 deletion build/package/mita/arm64/debian/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: mita
Version: 3.5.1
Version: 3.6.0
Section: net
Priority: optional
Architecture: arm64
Expand Down
2 changes: 1 addition & 1 deletion build/package/mita/arm64/rpm/mita.spec
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Name: mita
Version: 3.5.1
Version: 3.6.0
Release: 1%{?dist}
Summary: Mieru proxy server
License: GPLv3+
Expand Down
16 changes: 8 additions & 8 deletions docs/server-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,32 @@ Before installation and configuration, connect to the server via SSH and then ex

```sh
# Debian / Ubuntu - X86_64
curl -LSO https://github.com/enfein/mieru/releases/download/v3.5.1/mita_3.5.1_amd64.deb
curl -LSO https://github.com/enfein/mieru/releases/download/v3.6.0/mita_3.6.0_amd64.deb

# Debian / Ubuntu - ARM 64
curl -LSO https://github.com/enfein/mieru/releases/download/v3.5.1/mita_3.5.1_arm64.deb
curl -LSO https://github.com/enfein/mieru/releases/download/v3.6.0/mita_3.6.0_arm64.deb

# RedHat / CentOS / Rocky Linux - X86_64
curl -LSO https://github.com/enfein/mieru/releases/download/v3.5.1/mita-3.5.1-1.x86_64.rpm
curl -LSO https://github.com/enfein/mieru/releases/download/v3.6.0/mita-3.6.0-1.x86_64.rpm

# RedHat / CentOS / Rocky Linux - ARM 64
curl -LSO https://github.com/enfein/mieru/releases/download/v3.5.1/mita-3.5.1-1.aarch64.rpm
curl -LSO https://github.com/enfein/mieru/releases/download/v3.6.0/mita-3.6.0-1.aarch64.rpm
```

## Install mita package

```sh
# Debian / Ubuntu - X86_64
sudo dpkg -i mita_3.5.1_amd64.deb
sudo dpkg -i mita_3.6.0_amd64.deb

# Debian / Ubuntu - ARM 64
sudo dpkg -i mita_3.5.1_arm64.deb
sudo dpkg -i mita_3.6.0_arm64.deb

# RedHat / CentOS / Rocky Linux - X86_64
sudo rpm -Uvh --force mita-3.5.1-1.x86_64.rpm
sudo rpm -Uvh --force mita-3.6.0-1.x86_64.rpm

# RedHat / CentOS / Rocky Linux - ARM 64
sudo rpm -Uvh --force mita-3.5.1-1.aarch64.rpm
sudo rpm -Uvh --force mita-3.6.0-1.aarch64.rpm
```

Those instructions can also be used to upgrade the version of mita software package.
Expand Down
16 changes: 8 additions & 8 deletions docs/server-install.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,32 @@

```sh
# Debian / Ubuntu - X86_64
curl -LSO https://github.com/enfein/mieru/releases/download/v3.5.1/mita_3.5.1_amd64.deb
curl -LSO https://github.com/enfein/mieru/releases/download/v3.6.0/mita_3.6.0_amd64.deb

# Debian / Ubuntu - ARM 64
curl -LSO https://github.com/enfein/mieru/releases/download/v3.5.1/mita_3.5.1_arm64.deb
curl -LSO https://github.com/enfein/mieru/releases/download/v3.6.0/mita_3.6.0_arm64.deb

# RedHat / CentOS / Rocky Linux - X86_64
curl -LSO https://github.com/enfein/mieru/releases/download/v3.5.1/mita-3.5.1-1.x86_64.rpm
curl -LSO https://github.com/enfein/mieru/releases/download/v3.6.0/mita-3.6.0-1.x86_64.rpm

# RedHat / CentOS / Rocky Linux - ARM 64
curl -LSO https://github.com/enfein/mieru/releases/download/v3.5.1/mita-3.5.1-1.aarch64.rpm
curl -LSO https://github.com/enfein/mieru/releases/download/v3.6.0/mita-3.6.0-1.aarch64.rpm
```

## 安装 mita 软件包

```sh
# Debian / Ubuntu - X86_64
sudo dpkg -i mita_3.5.1_amd64.deb
sudo dpkg -i mita_3.6.0_amd64.deb

# Debian / Ubuntu - ARM 64
sudo dpkg -i mita_3.5.1_arm64.deb
sudo dpkg -i mita_3.6.0_arm64.deb

# RedHat / CentOS / Rocky Linux - X86_64
sudo rpm -Uvh --force mita-3.5.1-1.x86_64.rpm
sudo rpm -Uvh --force mita-3.6.0-1.x86_64.rpm

# RedHat / CentOS / Rocky Linux - ARM 64
sudo rpm -Uvh --force mita-3.5.1-1.aarch64.rpm
sudo rpm -Uvh --force mita-3.6.0-1.aarch64.rpm
```

上述指令也可以用来升级 mita 软件包的版本。
Expand Down
Loading

0 comments on commit d035bcc

Please sign in to comment.