trojan-usage-in-ubuntu
本文使用的trojan
版本是1.16.0
安装
从这官网地址下载最新的软件。
1 | cp -f trojan ~/.local/bin |
压缩包里面的config.json
是服务端的配置模板,这里暂时不用,只要进程即可。
配置
nvim ~/.local/etc/trojan.json
,根据机场的节点修改
1 | { |
run_type
: running trojan asclient
local_addr
: aSOCKS5
server interface will be bound to the specified interface. Feel free to change this to0.0.0.0
,::1
,::
or other addresses, if you know what you are doing.local_port
: aSOCKS5
interface will be bound to this portremote_addr
: server address (hostname)remote_port
: server portpassword
: password used for verification (only the first password in the array will be used)log_level
: how much log to dump. 0: ALL; 1: INFO; 2: WARN; 3: ERROR; 4: FATAL; 5: OFF.ssl
:SSL
specific configurationsverify
: whether to verifySSL
certificate STRONGLY RECOMMENDEDverify_hostname
: whether to verifySSL
hostname (specified in thesni
field) STRONGLY RECOMMENDEDcert
: ifverify
is set totrue
, the same certificate used by the server or a collection ofCA
certificates could be provided. If you leave this field blank,OpenSSL
will try to look for a systemCA
store and will be likely to fail. Certificates can be retrieved with this simple Python script.cipher
: a cipher list to send and usecipher_tls13
: a cipher list for TLS 1.3 to usesni
: the Server Name Indication field in theSSL
handshake. If left blank, it will be set toremote_addr
.alpn
: a list ofALPN
protocols to sendreuse_session
: whether to reuseSSL
sessionsession_ticket
: whether to use session tickets for session resumptioncurves
: ECC curves to send and use
tcp
: TCP specific configurationsno_delay
: whether to disable Nagle’s algorithmkeep_alive
: whether to enable TCP Keep Alivereuse_port
: whether to enable TCP port reuse (kernel support required)fast_open
: whether to enable TCP Fast Open (kernel support required)fast_open_qlen
: the server’s limit on the size of the queue of TFO requests that have not yet completed the three-way handshake
系统服务
sudo -E vim /etc/systemd/system/trojan.service
1 | [Unit] |
运行
1 | systemctl start trojan |