Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cmd/protoplex/protoplex.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func main() {
socks5 := app.Flag("socks5", "The SOCKS5 server address").String()
socks4 := app.Flag("socks4", "The SOCKS4 server address").String()
// stRelay := flag.String("strelay", "", "The Syncthing Relay server address")
fallback := app.Flag("fallback", "The fallback address. If no protocol match, this address will be used.").String()

_, _ = app.Parse(os.Args[1:])

Expand Down Expand Up @@ -83,6 +84,9 @@ func main() {
if *http != "" {
p = append(p, protocols.NewHTTPProtocol(*http))
}
if *fallback != "" {
p = append(p, protocols.FallbackProtocol(*fallback))
}

protoplex.RunServer(*bind, p, logger)
}
10 changes: 10 additions & 0 deletions protoplex/protocols/fallback.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package protocols

// FallbackProtocol initializes a Protocol with a SOCKS4 signature.
func FallbackProtocol(targetAddress string) *Protocol {
return &Protocol{
Name: "Fallback",
Target: targetAddress,
MatchBytes: [][]byte{{}},
}
}