Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 33 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## Yet another SIP003 plugin for shadowsocks, based on [v2ray](https://github.com/v2fly/v2ray-core)
## Yet another SIP003 plugin for shadowsocks, based on [v2ray-core](https://github.com/v2fly/v2ray-core)

[![CircleCI](https://circleci.com/gh/shadowsocks/v2ray-plugin.svg?style=shield)](https://circleci.com/gh/shadowsocks/v2ray-plugin)
[![Releases](https://img.shields.io/github/downloads/shadowsocks/v2ray-plugin/total.svg)](https://github.com/shadowsocks/v2ray-plugin/releases)
[![Language: Go](https://img.shields.io/badge/go-1.13+-blue.svg)](https://github.com/shadowsocks/v2ray-plugin/search?l=go)
[![Language: Go](https://img.shields.io/badge/go-1.22+-blue.svg)](https://github.com/shadowsocks/v2ray-plugin/search?l=go)
[![Go Report Card](https://goreportcard.com/badge/github.com/shadowsocks/v2ray-plugin)](https://goreportcard.com/report/github.com/shadowsocks/v2ray-plugin)
[![License](https://img.shields.io/github/license/shadowsocks/v2ray-plugin.svg)](LICENSE)

Expand All @@ -11,6 +11,30 @@
* `go build`
* Alternatively, you can grab the latest nightly from Circle CI by logging into Circle CI or adding `#artifacts` at the end of URL like such: https://circleci.com/gh/shadowsocks/v2ray-plugin/20#artifacts

## Command Line Options

```
-server Run in server mode
-fast-open Enable TCP fast open
-localAddr Local address to listen on (default: 127.0.0.1)
-localPort Local port to listen on (default: 1984)
-remoteAddr Remote address to forward (default: 127.0.0.1)
-remotePort Remote port to forward (default: 1080)
-path URL path for websocket (default: /)
-host Hostname for server (default: cloudfront.com)
-tls Enable TLS
-cert Path to TLS certificate file (default: ~/.acme.sh/{host}/fullchain.cer)
-certRaw Raw TLS certificate content (PEM format, intended for Android)
-key (server) Path to TLS key file (default: ~/.acme.sh/{host}/{host}.key)
-mode Transport mode: websocket, quic (default: websocket)
-mux Concurrent multiplexed connections, websocket client mode only (default: 1)
-loglevel Log level for v2ray: debug, info, warning (default), error, none
-insecure Skip TLS certificate verification
-fwmark Set SO_MARK option for outbound sockets (Linux only)
-version Show current version of v2ray-plugin
-V Run in VPN mode (Android only)
```

## Usage

See command line args for advanced usages.
Expand Down Expand Up @@ -75,3 +99,10 @@ Alternatively, you can specify path to your certificates using option `cert` and
### Use `certRaw` to pass certificate

Instead of using `cert` to pass the certificate file, `certRaw` could be used to pass in PEM format certificate, that is the content between `-----BEGIN CERTIFICATE-----` and `-----END CERTIFICATE-----` without the line breaks.

### Other options

* Use `insecure` to skip TLS certificate verification.
* Use `fastOpen` to enable TCP fast open.
* Use `fwmark` to set SO_MARK option for outbound sockets (Linux only).
* Use `loglevel` to control log verbosity. Available values: `debug`, `info`, `warning`, `error`, `none`.
7 changes: 6 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ var (
logLevel = flag.String("loglevel", "", "loglevel for v2ray: debug, info, warning (default), error, none.")
version = flag.Bool("version", false, "Show current version of v2ray-plugin")
fwmark = flag.Int("fwmark", 0, "Set SO_MARK option for outbound sockets.")
insecure = flag.Bool("insecure", false, "Skip TLS certificate verification.")
)

func homeDir() string {
Expand Down Expand Up @@ -163,7 +164,7 @@ func generateConfig() (*core.Config, error) {
streamConfig.SocketSettings = socketConfig
}
if *tlsEnabled {
tlsConfig := tls.Config{ServerName: *host}
tlsConfig := tls.Config{ServerName: *host, AllowInsecure: *insecure}
if *server {
certificate := tls.Certificate{}
if *cert == "" && *certRaw == "" {
Expand Down Expand Up @@ -326,6 +327,10 @@ func startV2Ray() (core.Server, error) {
}
}

if _, b := opts.Get("insecure"); b {
*insecure = true
}

if _, b := opts.Get("fastOpen"); b {
*fastOpen = true
}
Expand Down