mirror of
https://github.com/howmp/reality
synced 2025-02-22 18:12:20 +08:00
add mips arch, add skip client cert verify option
This commit is contained in:
parent
d527e5cc90
commit
a69fea65a6
@ -43,6 +43,7 @@ Help Options:
|
|||||||
-e= expire second (default: 30)
|
-e= expire second (default: 30)
|
||||||
-o= server config output path (default: config.json)
|
-o= server config output path (default: config.json)
|
||||||
-c= client count (default: 3)
|
-c= client count (default: 3)
|
||||||
|
-s skip client cert verify
|
||||||
--dir= client output directory (default: .)
|
--dir= client output directory (default: .)
|
||||||
|
|
||||||
[gen command arguments]
|
[gen command arguments]
|
||||||
@ -104,3 +105,9 @@ Usage of grsu:
|
|||||||
1. 也可以NTP同步客户端、用户端、服务端时间
|
1. 也可以NTP同步客户端、用户端、服务端时间
|
||||||
1. 服务端配置重新生成后,也需要使用最新的`grsc`和`grsu`,否则预共享密钥不匹配
|
1. 服务端配置重新生成后,也需要使用最新的`grsc`和`grsu`,否则预共享密钥不匹配
|
||||||
1. 客户端的网络可能被劫持
|
1. 客户端的网络可能被劫持
|
||||||
|
|
||||||
|
### 为什么客户端/用户端提示`certificate signed by unknown authority`?
|
||||||
|
|
||||||
|
运行环境缺少根证书,可以生成时指定`-s`选项,跳过验证
|
||||||
|
|
||||||
|
`grss gen -s www.qq.com:443 127.0.0.1:443`
|
3
build.sh
3
build.sh
@ -5,12 +5,14 @@ CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -trimpath -ldflags "-s -w" -o ./
|
|||||||
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -trimpath -ldflags "-s -w" -o ./cmd/grss/client/grsc_darwin_arm64 ./cmd/grsc
|
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -trimpath -ldflags "-s -w" -o ./cmd/grss/client/grsc_darwin_arm64 ./cmd/grsc
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags "-s -w" -o ./cmd/grss/client/grsc_linux_amd64 ./cmd/grsc
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags "-s -w" -o ./cmd/grss/client/grsc_linux_amd64 ./cmd/grsc
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -trimpath -ldflags "-s -w" -o ./cmd/grss/client/grsc_linux_arm64 ./cmd/grsc
|
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -trimpath -ldflags "-s -w" -o ./cmd/grss/client/grsc_linux_arm64 ./cmd/grsc
|
||||||
|
CGO_ENABLED=0 GOOS=linux GOARCH=mips go build -trimpath -ldflags "-s -w" -o ./cmd/grss/client/grsc_linux_mips ./cmd/grsc
|
||||||
CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -trimpath -ldflags "-s -w" -o ./cmd/grss/client/grsc_windows.exe ./cmd/grsc
|
CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -trimpath -ldflags "-s -w" -o ./cmd/grss/client/grsc_windows.exe ./cmd/grsc
|
||||||
|
|
||||||
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -trimpath -ldflags "-s -w" -o ./cmd/grss/client/grsu_darwin_amd64 ./cmd/grsu
|
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -trimpath -ldflags "-s -w" -o ./cmd/grss/client/grsu_darwin_amd64 ./cmd/grsu
|
||||||
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -trimpath -ldflags "-s -w" -o ./cmd/grss/client/grsu_darwin_arm64 ./cmd/grsu
|
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -trimpath -ldflags "-s -w" -o ./cmd/grss/client/grsu_darwin_arm64 ./cmd/grsu
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags "-s -w" -o ./cmd/grss/client/grsu_linux_amd64 ./cmd/grsu
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags "-s -w" -o ./cmd/grss/client/grsu_linux_amd64 ./cmd/grsu
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -trimpath -ldflags "-s -w" -o ./cmd/grss/client/grsu_linux_arm64 ./cmd/grsu
|
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -trimpath -ldflags "-s -w" -o ./cmd/grss/client/grsu_linux_arm64 ./cmd/grsu
|
||||||
|
CGO_ENABLED=0 GOOS=linux GOARCH=mips go build -trimpath -ldflags "-s -w" -o ./cmd/grss/client/grsu_linux_mips ./cmd/grsu
|
||||||
CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -trimpath -ldflags "-s -w" -o ./cmd/grss/client/grsu_windows.exe ./cmd/grsu
|
CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -trimpath -ldflags "-s -w" -o ./cmd/grss/client/grsu_windows.exe ./cmd/grsu
|
||||||
|
|
||||||
go-bindata -nomemcopy -nometadata -prefix cmd/grss/client -o ./cmd/grss/files.go ./cmd/grss/client/
|
go-bindata -nomemcopy -nometadata -prefix cmd/grss/client -o ./cmd/grss/files.go ./cmd/grss/client/
|
||||||
@ -19,6 +21,7 @@ CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -tags forceposix -trimpath -ldfl
|
|||||||
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -tags forceposix -trimpath -ldflags "-s -w" -o ./dist/grss_darwin_arm64 ./cmd/grss
|
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -tags forceposix -trimpath -ldflags "-s -w" -o ./dist/grss_darwin_arm64 ./cmd/grss
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -tags forceposix -trimpath -ldflags "-s -w" -o ./dist/grss_linux_amd64 ./cmd/grss
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -tags forceposix -trimpath -ldflags "-s -w" -o ./dist/grss_linux_amd64 ./cmd/grss
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -tags forceposix -trimpath -ldflags "-s -w" -o ./dist/grss_linux_arm64 ./cmd/grss
|
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -tags forceposix -trimpath -ldflags "-s -w" -o ./dist/grss_linux_arm64 ./cmd/grss
|
||||||
|
CGO_ENABLED=0 GOOS=linux GOARCH=mips go build -tags forceposix -trimpath -ldflags "-s -w" -o ./dist/grss_linux_mips ./cmd/grss
|
||||||
CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -tags forceposix -trimpath -ldflags "-s -w" -o ./dist/grss_windows.exe ./cmd/grss
|
CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -tags forceposix -trimpath -ldflags "-s -w" -o ./dist/grss_windows.exe ./cmd/grss
|
||||||
|
|
||||||
cp README.md ./dist
|
cp README.md ./dist
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
type ClientConfig struct {
|
type ClientConfig struct {
|
||||||
ServerAddr string `json:"server_addr"`
|
ServerAddr string `json:"server_addr"`
|
||||||
SNI string `json:"sni_name"`
|
SNI string `json:"sni_name"`
|
||||||
|
SkipVerify bool `json:"skip_verify"`
|
||||||
PublicKeyECDH string `json:"public_key_ecdh"`
|
PublicKeyECDH string `json:"public_key_ecdh"`
|
||||||
PublicKeyVerify string `json:"public_key_verify"`
|
PublicKeyVerify string `json:"public_key_verify"`
|
||||||
FingerPrint string `json:"finger_print"`
|
FingerPrint string `json:"finger_print"`
|
||||||
@ -185,6 +186,7 @@ func NewClient(ctx context.Context, config *ClientConfig) (net.Conn, error) {
|
|||||||
ServerName: config.SNI,
|
ServerName: config.SNI,
|
||||||
SessionTicketsDisabled: true,
|
SessionTicketsDisabled: true,
|
||||||
MaxVersion: utls.VersionTLS12,
|
MaxVersion: utls.VersionTLS12,
|
||||||
|
InsecureSkipVerify: config.SkipVerify,
|
||||||
},
|
},
|
||||||
*config.fingerPrint,
|
*config.fingerPrint,
|
||||||
)
|
)
|
||||||
|
@ -22,6 +22,7 @@ type gen struct {
|
|||||||
ExpireSecond uint32 `short:"e" default:"30" description:"expire second"`
|
ExpireSecond uint32 `short:"e" default:"30" description:"expire second"`
|
||||||
ConfigPath string `short:"o" default:"config.json" description:"server config output path"`
|
ConfigPath string `short:"o" default:"config.json" description:"server config output path"`
|
||||||
ClientCount byte `short:"c" default:"3" description:"client count"`
|
ClientCount byte `short:"c" default:"3" description:"client count"`
|
||||||
|
SkipVerify bool `short:"s" description:"skip client cert verify"`
|
||||||
ClientOutputDir string `long:"dir" default:"." description:"client output directory"`
|
ClientOutputDir string `long:"dir" default:"." description:"client output directory"`
|
||||||
Positional struct {
|
Positional struct {
|
||||||
SNIAddr string `description:"tls server address, e.g. example.com:443"`
|
SNIAddr string `description:"tls server address, e.g. example.com:443"`
|
||||||
@ -109,6 +110,7 @@ func (c *gen) genConfig() (*reality.ServerConfig, error) {
|
|||||||
config.Debug = c.Debug
|
config.Debug = c.Debug
|
||||||
config.ClientFingerPrint = c.FingerPrint
|
config.ClientFingerPrint = c.FingerPrint
|
||||||
config.ExpireSecond = c.ExpireSecond
|
config.ExpireSecond = c.ExpireSecond
|
||||||
|
config.SkipVerify = c.SkipVerify
|
||||||
data, err := json.MarshalIndent(config, "", " ")
|
data, err := json.MarshalIndent(config, "", " ")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -22,6 +22,7 @@ import (
|
|||||||
type ServerConfig struct {
|
type ServerConfig struct {
|
||||||
SNIAddr string `json:"sni_addr"`
|
SNIAddr string `json:"sni_addr"`
|
||||||
ServerAddr string `json:"server_addr"`
|
ServerAddr string `json:"server_addr"`
|
||||||
|
SkipVerify bool `json:"skip_verify"`
|
||||||
PrivateKeyECDH string `json:"private_key_ecdh"`
|
PrivateKeyECDH string `json:"private_key_ecdh"`
|
||||||
PrivateKeySign string `json:"private_key_sign"`
|
PrivateKeySign string `json:"private_key_sign"`
|
||||||
ExpireSecond uint32 `json:"expire_second"`
|
ExpireSecond uint32 `json:"expire_second"`
|
||||||
@ -111,6 +112,7 @@ func (s *ServerConfig) ToClientConfig(overlayData byte) *ClientConfig {
|
|||||||
return &ClientConfig{
|
return &ClientConfig{
|
||||||
SNI: s.sniHost,
|
SNI: s.sniHost,
|
||||||
ServerAddr: s.ServerAddr,
|
ServerAddr: s.ServerAddr,
|
||||||
|
SkipVerify: s.SkipVerify,
|
||||||
PublicKeyECDH: base64.StdEncoding.EncodeToString(s.privateKeyECDH.PublicKey().Bytes()),
|
PublicKeyECDH: base64.StdEncoding.EncodeToString(s.privateKeyECDH.PublicKey().Bytes()),
|
||||||
PublicKeyVerify: base64.StdEncoding.EncodeToString(s.privateKeySign.Public().(ed25519.PublicKey)),
|
PublicKeyVerify: base64.StdEncoding.EncodeToString(s.privateKeySign.Public().(ed25519.PublicKey)),
|
||||||
ExpireSecond: s.ExpireSecond,
|
ExpireSecond: s.ExpireSecond,
|
||||||
|
Loading…
Reference in New Issue
Block a user