1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

go-transproxy as a service

Last updated at Posted at 2020-01-30

プロキシとの戦いに疲れたのでgoで透過プロキシを作ってみた - Qiita

Systemdを使ってさくっと自作コマンドをサービス化してみる - Qiita

sudo nano /etc/systemd/system/transproxy.service

[Unit]
Description = go-transproxy service

[Service]
ExecStart = {fullpath}/go-transproxy/bin/transproxy  -private-dns {option_value} -dns-over-https-enabled -tcp-proxy-dports 2222 {othe optionr}
Restart = always
Type = simple
Environment = "http_proxy=http://{ip}:{port}"
Environment = "https_proxy=http://{ip}:{port}"
Environment = "no_proxy={ip},{hostname},{etc}"
StandardOutput = null

[Install]
WantedBy = multi-user.target

sudo systemctl daemon-reload
sudo systemctl enable transproxy.service
sudo systemctl start transproxy.service
sudo systemctl status transproxy.service

これは私の環境でコンテナを使うとき用の設定であり、起動オプションはそれぞれの環境・用途に合わせて変える必要あり。

また、デフォルトで22番ポートを制御しちゃう(してくれる)ので、--tcp-proxy-dportsオプションで適当なポートに変えてあげないとSSH経由でログインできなくなった。
SSH接続するときに以下のような、

ssh_exchange_identification: read: Connection reset by peer

や、

Remote side unexpectedly closed network connection

などのエラーが出たらここを疑うべし。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?