-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
210 additions
and
146 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
* homebrew / AUR | ||
* measure throughput (https://stackoverflow.com/questions/72808002/is-there-a-way-to-get-transfer-speed-from-io-copy) | ||
* open and close --all command | ||
* measure throughput / latency? (https://stackoverflow.com/questions/72808002/is-there-a-way-to-get-transfer-speed-from-io-copy) | ||
* open and close --all command, glob support | ||
* ssh connection multiplexing (multiple tunnels share same ssh conn) | ||
* HTTP proxy? | ||
* scriptable hooks | ||
* documentation |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"time" | ||
|
||
"github.com/alebeck/boring/internal/log" | ||
"github.com/alebeck/boring/internal/tunnel" | ||
) | ||
|
||
func status(t *tunnel.Tunnel) string { | ||
switch t.Status { | ||
case tunnel.Closed: | ||
return log.Red + "closed" + log.Reset | ||
case tunnel.Reconn: | ||
return log.Yellow + "reconn" + log.Reset | ||
} | ||
|
||
// Tunnel is open, show uptime | ||
since := time.Since(t.LastConn) | ||
days := int(since / (24 * time.Hour)) | ||
hours := int(since/time.Hour) % 24 | ||
mins := int(since/time.Minute) % 60 | ||
secs := int(since/time.Second) % 60 | ||
var str string | ||
if days > 0 { | ||
str = fmt.Sprintf("%02dd%02dh", days, hours) | ||
} else if hours > 0 { | ||
str = fmt.Sprintf("%02dh%02dm", hours, mins) | ||
} else { | ||
str = fmt.Sprintf("%02dm%02ds", mins, secs) | ||
} | ||
return log.Green + str + log.Reset | ||
} |
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
Oops, something went wrong.