Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b24b8d2

Browse filesBrowse files
committed
Support pprof
1 parent 44dd097 commit b24b8d2
Copy full SHA for b24b8d2

File tree

Expand file treeCollapse file tree

1 file changed

+11
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+11
-0
lines changed
Open diff view settings
Collapse file

‎cmd/bridge/main.go‎

Copy file name to clipboardExpand all lines: cmd/bridge/main.go
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"encoding/json"
66
"fmt"
77
"log/slog"
8+
"net/http"
89
"os"
910
"sync"
1011
"syscall"
@@ -44,6 +45,7 @@ var (
4445
idleTimeout time.Duration
4546
dials []string
4647
dump bool
48+
pprofAddress string
4749
)
4850

4951
const defaults = `Bridge is a TCP proxy tool Support http(s)-connect socks4/4a/5/5h ssh proxycommand
@@ -62,6 +64,7 @@ func init() {
6264
flag.StringSliceVarP(&listens, "bind", "b", nil, "The first is the listening address, and then the proxy through which the listening address passes.\nIf it is not filled in, it is redirected to the pipeline.\nonly ssh and local support listening, so the last proxy must be ssh.")
6365
flag.StringSliceVarP(&dials, "proxy", "p", nil, "The first is the dial-up address, followed by the proxy through which the dial-up address passes.")
6466
flag.DurationVar(&idleTimeout, "idle-timeout", 0, "The idle timeout for connections.")
67+
flag.StringVar(&pprofAddress, "pprof", "", "The pprof address.")
6568
flag.BoolVarP(&dump, "debug", "d", dump, "Output the communication data.")
6669
flag.Parse()
6770

@@ -81,6 +84,14 @@ func printDefaults() {
8184
}
8285

8386
func main() {
87+
if pprofAddress != "" {
88+
go func() {
89+
err := http.ListenAndServe(pprofAddress, http.DefaultServeMux)
90+
if err != nil {
91+
logger.Std.Error("ListenAndServe", "err", err)
92+
}
93+
}()
94+
}
8495
var tasks []config.Chain
8596
var err error
8697
if len(configs) != 0 {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.