Skip to content

Commit

Permalink
Add username option for mgraftcp
Browse files Browse the repository at this point in the history
  • Loading branch information
hmgle committed May 31, 2024
1 parent 8481a33 commit 8f330d3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions local/cmd/mgraftcp/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ var (

blackIPFile string
whiteIPFile string
userName string
notIgnoreLocal bool
enableDebugLog bool

Expand All @@ -79,6 +80,7 @@ func init() {
getopt.FlagLong(&blackIPFile, "blackip-file", 'b', "The IP in black-ip-file will connect direct")
getopt.FlagLong(&whiteIPFile, "whiteip-file", 'w', "Only redirect the connect that destination ip in the white-ip-file to SOCKS5")
getopt.FlagLong(&notIgnoreLocal, "not-ignore-local", 'n', "Connecting to local is not changed by default, this option will redirect it to SOCKS5")
getopt.FlagLong(&userName, "username", 'u', "Run command as USERNAME handling setuid and/or setgid")
getopt.FlagLong(&help, "help", 'h', "Display this help and exit")
getopt.FlagLong(&showVersion, "version", 0, "Print the mgraftcp version information")
}
Expand Down Expand Up @@ -241,6 +243,9 @@ func main() {
if whiteIPFile != "" {
fixArgs = append(fixArgs, "-w", whiteIPFile)
}
if userName != "" {
fixArgs = append(fixArgs, "-u", userName)
}
if notIgnoreLocal {
fixArgs = append(fixArgs, "-n")
}
Expand Down

0 comments on commit 8f330d3

Please sign in to comment.