Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

manpage

Yongsheng Xu edited this page Oct 11, 2021 · 6 revisions

PEGASOCKS(1) Manual Page

NAME

pegas - A lightweight proxy client written in C, intends to support multiple protocols

SYNOPSIS

pegas [OPTIONS]

DESCRIPTION

The pegas(1) is a (socks5)proxy client written in C, intended to support multiple types of proxy protocols(trojan, v2ray, *shadowsocks, ..). It is lightweight and supports unix-like systems(Linux/WSL/BSDs/OSX).

OPTIONS

-a <ACL>

Specifies the ACL file if pegas is build with ACL feature

-c <CONFIG>

Specifies the configuration file, by default it will try $XDG_CONFIG_HOME/.pegasrc or $XDG_CONFIG_HOME/pegas/config in order.

-t <THREAD>

Specifies the number of worker threads, default is 4

CONFIGS

ROOT

The configuration file of pegasocks is in json format, the outermost fields are as follows, the fields with * are optional fields.

Filed Type Description

servers

SERVER

Array of SERVER, check SERVER section for detail.

local_address

string

For example: 127.0.0.1, 0.0.0.0

local_port

int

For example: 1080

log_level

int

0(debug), 1(info), 2(warn), 3(error)

*log_file

string

Log file location. if set, the log will be written to the specified location, if not set, it will be written to stderr by default

*ping_interval

int

The program will periodically check the network status of the server. Here you can set the check interval. The default is 120, and the unit is second.

*control_port

int

if set, pegas will listen on the port(TCP), and users can interact with pegas through this port

*control_file

string

pegas will listen on an unix socket by default(/tmp/pegas.sock), if control_port is set, this option will be ignored

*dns_servers

array of string

if set, pegas will only use the setted servers to resolve DNS, by default, it will initiate DNS with EVDNS_BASE_INITIALIZE_NAMESERVERS of libevent.

*ssl.cert

string (path)

The crt file to use for ssl, for example: /etc/ssl/ca-certificates.crt or /usr/local/etc/openssl/cert.pem

*ssl.verify

boolean

If set to false, it will skip ssl verification, default to true.

*android.protect_address

string

Protect server address(Android only).

*android.protect_port

int

Protect server port(Android only, pass fd in, do protection and return the fd out, return -1 if failed).

SERVER

All types of server have some common fields

Filed Type Description

server_type

string

Type of server, v2ray, trojan and shadowsocks are supported now

server_address

string

IP or hostname of your server

server_port

string

password

string

for v2ray, it’s uuid, for shadowsocks and trojan, it’s the password

V2RAY

If server_type is v2ray, there’re some other fields

Filed Type Description

secure

string

Encryption algorithm of vmess, supports aes-128-cfb, aes-128-gcm and chacha20-poly1305 , default to aes-128-cfb

ssl.sni

string

If ssl is enabled, the sni of remote server

websocket.path

string

If websocket is enabled, the path of remote server

TROJAN

If server_type is trojan, there’re some other fields

Filed Type Description

websocket.path

string

If websocket is enabled, the path of remote server

SHADOWSOCKS

If server_type is shadowsocks, there’re some other fields

Filed Type Description

method

string

The crypto method, aes-128-cfb,aes-128-gcm, aes-256-gcm and chacha20-poly1305 are supported, default to aes-128-gcm

PS: UDP and plugin support is WIP

EXAMPLES

trojan-gfw

{
  "servers": [
    {
      "server_address": "yourhost.com",
      "server_type": "trojan",
      "server_port": 443,
      "password": "password"
    }
  ],
  "local_address": "0.0.0.0",
  "local_port": 1080,
  "log_level": 1
}

trojan-go

{
  "servers": [
    {
      "server_address": "yourhost.com",
      "server_type": "trojan",
      "server_port": 443,
      "password": "password",
      "websocket": {
        "path": "/trojan",
        "hostname": "yourhost.com"
      }
    }
  ],
  "local_address": "0.0.0.0",
  "local_port": 1080,
  "log_level": 1
}

v2ray + tls + websocket

{
  "servers": [
    {
      "server_address": "yourhost.com",
      "server_type": "v2ray",
      "server_port": 443,
      "password": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "ssl": {"sni": "ray.yourhost.com"},
      "websocket": {
        "path": "/ray",
        "hostname": "yourhost.com"
      }
    }
  ],
  "local_address": "0.0.0.0",
  "local_port": 1080,
  "log_level": 1
}

v2ray + tcp

{
  "servers": [
    {
      "server_address": "xxxxx.jamjams.net",
      "server_type": "v2ray",
      "server_port": 10086,
      "secure": "aes-128-gcm",
      "password": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    }
  ],
  "local_address": "0.0.0.0",
  "local_port": 1080,
  "log_level": 1
}

AUTHOR

Yongsheng Xu <chuxdesign@hotmail.com>

Clone this wiki locally