-
Notifications
You must be signed in to change notification settings - Fork 415
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new function & Update README, close #29
- Loading branch information
Showing
10 changed files
with
121 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package handler | ||
|
||
import ( | ||
"Stowaway/admin/manager" | ||
"fmt" | ||
) | ||
|
||
func ShowStatus(mgr *manager.Manager, uuid string) { | ||
forwardTask := &manager.ForwardTask{ | ||
Mode: manager.F_GETFORWARDINFO, | ||
UUID: uuid, | ||
} | ||
mgr.ForwardManager.TaskChan <- forwardTask | ||
forwardResult := <-mgr.ForwardManager.ResultChan | ||
|
||
backwardTask := &manager.BackwardTask{ | ||
Mode: manager.B_GETBACKWARDINFO, | ||
UUID: uuid, | ||
} | ||
mgr.BackwardManager.TaskChan <- backwardTask | ||
backwardResult := <-mgr.BackwardManager.ResultChan | ||
|
||
socksTask := &manager.SocksTask{ | ||
Mode: manager.S_GETSOCKSINFO, | ||
UUID: uuid, | ||
} | ||
mgr.SocksManager.TaskChan <- socksTask | ||
socksResult := <-mgr.SocksManager.ResultChan | ||
// show socks | ||
fmt.Print("\r\nSocks status:") | ||
if socksResult.OK { | ||
fmt.Printf( | ||
"\r\n ListenAddr: %s:%s Username: %s Password: %s", | ||
socksResult.SocksInfo.Addr, | ||
socksResult.SocksInfo.Port, | ||
socksResult.SocksInfo.Username, | ||
socksResult.SocksInfo.Password, | ||
) | ||
} | ||
fmt.Print("\r\n-------------------------------------------------------------------------------------------") | ||
// show forward | ||
fmt.Print("\r\nForward status:") | ||
if forwardResult.OK { | ||
for _, info := range forwardResult.ForwardInfo { | ||
fmt.Printf( | ||
"\r\n [%d] Listening Addr: %s , Remote Addr: %s , Active Connnections: %d", | ||
info.Seq, | ||
info.Laddr, | ||
info.Raddr, | ||
info.ActiveNum, | ||
) | ||
} | ||
} | ||
fmt.Print("\r\n-------------------------------------------------------------------------------------------") | ||
// show backward | ||
fmt.Print("\r\nBackward status:") | ||
if backwardResult.OK { | ||
for _, info := range backwardResult.BackwardInfo { | ||
fmt.Printf( | ||
"\r\n [%d] Remote Port: %s , Local Port: %s , Active Connnections: %d", | ||
info.Seq, | ||
info.RPort, | ||
info.LPort, | ||
info.ActiveNum, | ||
) | ||
} | ||
} | ||
} |