Skip to content

Commit 555f3b2

Browse files
updated README with daemon info
1 parent 64974b8 commit 555f3b2

File tree

3 files changed

+40
-17
lines changed

3 files changed

+40
-17
lines changed

README.md

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ You can download the binary for your platform from [Releases](https://github.com
6868
Example:
6969

7070
```shell
71-
HPTS_RELEASE=v1.6.0; wget -v https://github.com/shadowy-pycoder/go-http-proxy-to-socks/releases/download/$HPTS_RELEASE/gohpts-$HPTS_RELEASE-linux-amd64.tar.gz -O gohpts && tar xvzf gohpts && mv -f gohpts-$HPTS_RELEASE-linux-amd64 gohpts && ./gohpts -h
71+
HPTS_RELEASE=v1.6.1; wget -v https://github.com/shadowy-pycoder/go-http-proxy-to-socks/releases/download/$HPTS_RELEASE/gohpts-$HPTS_RELEASE-linux-amd64.tar.gz -O gohpts && tar xvzf gohpts && mv -f gohpts-$HPTS_RELEASE-linux-amd64 gohpts && ./gohpts -h
7272
```
7373

7474
Alternatively, you can install it using `go install` command (requires Go [1.24](https://go.dev/doc/install) or later):
@@ -105,29 +105,32 @@ GitHub: https://github.com/shadowy-pycoder/go-http-proxy-to-socks
105105
Usage: gohpts [OPTIONS]
106106
Options:
107107
-h Show this help message and exit.
108+
-D Run as a daemon (provide -logfile to see logs)
108109
-M value
109-
Transparent proxy mode: [redirect tproxy]
110+
Transparent proxy mode: [redirect tproxy]
110111
-T string
111-
Address of transparent proxy server (no HTTP)
112+
Address of transparent proxy server (no HTTP)
112113
-U string
113-
User for HTTP proxy (basic auth). This flag invokes prompt for password (not echoed to terminal)
114+
User for HTTP proxy (basic auth). This flag invokes prompt for password (not echoed to terminal)
114115
-c string
115-
Path to certificate PEM encoded file
116-
-d Show logs in DEBUG mode
116+
Path to certificate PEM encoded file
117+
-d Show logs in DEBUG mode
117118
-f string
118-
Path to server configuration file in YAML format
119-
-j Show logs in JSON format
119+
Path to server configuration file in YAML format
120+
-j Show logs in JSON format
120121
-k string
121-
Path to private key PEM encoded file
122+
Path to private key PEM encoded file
122123
-l string
123-
Address of HTTP proxy server (default "127.0.0.1:8080")
124+
Address of HTTP proxy server (default "127.0.0.1:8080")
125+
-logfile string
126+
Log file path (Default: stdout)
124127
-s string
125-
Address of SOCKS5 proxy server (default "127.0.0.1:1080")
128+
Address of SOCKS5 proxy server (default "127.0.0.1:1080")
126129
-t string
127-
Address of transparent proxy server (it starts along with HTTP proxy server)
130+
Address of transparent proxy server (it starts along with HTTP proxy server)
128131
-u string
129-
User for SOCKS5 proxy authentication. This flag invokes prompt for password (not echoed to terminal)
130-
-v print version
132+
User for SOCKS5 proxy authentication. This flag invokes prompt for password (not echoed to terminal)
133+
-v print version
131134
```
132135

133136
### Configuration via CLI flags
@@ -166,6 +169,26 @@ Run http proxy over TLS connection
166169
gohpts -s 1080 -l 8080 -c "path/to/certificate" -k "path/to/private/key"
167170
```
168171

172+
Run proxy as a daemon (logfile is needed for logging output, otherwise you will see nothing)
173+
174+
```shell
175+
gohpts -D -logfile /tmp/gohpts.log
176+
```
177+
178+
```shell
179+
# output
180+
gohpts pid: <pid>
181+
```
182+
183+
```shell
184+
# kill the process
185+
kill <pid>
186+
#or
187+
kill $(pidof gohpts)
188+
```
189+
190+
`-u` and `-U` flags do not work in a daemon mode (and therefore authentication), but you can provide a config file (see below)
191+
169192
### Configuration via YAML file
170193

171194
Run http proxy in SOCKS5 proxy chain mode (specify server settings via YAML configuration file)

cmd/gohpts/cli.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func root(args []string) error {
5656
return nil
5757
})
5858
}
59-
flags.StringVar(&conf.LogFilePath, "logfile", "", "Log file path (Default: stdout")
59+
flags.StringVar(&conf.LogFilePath, "logfile", "", "Log file path (Default: stdout)")
6060
flags.BoolVar(&conf.Debug, "d", false, "Show logs in DEBUG mode")
6161
flags.BoolVar(&conf.Json, "j", false, "Show logs in JSON format")
6262
flags.BoolFunc("v", "print version", func(flagValue string) error {
@@ -161,7 +161,7 @@ func root(args []string) error {
161161
if err != nil {
162162
return err
163163
}
164-
fmt.Println("%s pid:", app, process.Pid)
164+
fmt.Printf("%s pid: %d\n", app, process.Pid)
165165
process.Release()
166166
os.Exit(0)
167167
}

version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
package gohpts
22

3-
const Version string = "gohpts v1.6.0"
3+
const Version string = "gohpts v1.6.1"

0 commit comments

Comments
 (0)