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 asclientlocal_addr: aSOCKS5server 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: aSOCKS5interface 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:SSLspecific configurationsverify: whether to verifySSLcertificate STRONGLY RECOMMENDEDverify_hostname: whether to verifySSLhostname (specified in thesnifield) STRONGLY RECOMMENDEDcert: ifverifyis set totrue, the same certificate used by the server or a collection ofCAcertificates could be provided. If you leave this field blank,OpenSSLwill try to look for a systemCAstore 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 theSSLhandshake. If left blank, it will be set toremote_addr.alpn: a list ofALPNprotocols to sendreuse_session: whether to reuseSSLsessionsession_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 |