This repository has been archived by the owner on Jun 16, 2019. It is now read-only.
forked from shadowsocks/shadowsocks-go
-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from orvice/dev
Dev
- Loading branch information
Showing
12 changed files
with
132 additions
and
4 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 |
---|---|---|
|
@@ -17,4 +17,5 @@ install: | |
- go install ./mu | ||
script: | ||
- cd mu && go build | ||
- go test -cover ./... | ||
sudo: required |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package log | ||
|
||
import ( | ||
"github.com/orvice/shadowsocks-go/mu/user" | ||
) | ||
|
||
type Client interface { | ||
Info(user user.User, args ...interface{}) | ||
Error(user user.User, args ...interface{}) | ||
Debug(user user.User, args ...interface{}) | ||
} |
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 |
---|---|---|
|
@@ -7,3 +7,7 @@ import ( | |
var ( | ||
Log = logrus.New() | ||
) | ||
|
||
func SetLogClient(client *logrus.Logger) { | ||
Log = client | ||
} |
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,27 @@ | ||
package system | ||
|
||
import ( | ||
"os/exec" | ||
"strings" | ||
) | ||
|
||
type Client struct { | ||
} | ||
|
||
func GetLoad() (string, error) { | ||
output, err := exec.Command("cat", "/proc/loadavg").Output() | ||
if err != nil { | ||
return "", err | ||
} | ||
|
||
return string(output), nil | ||
} | ||
|
||
func GetUptime() (string, error) { | ||
output, err := exec.Command("cat", "/proc/uptime").Output() | ||
if err != nil { | ||
return "", err | ||
} | ||
loadAry := strings.Split(string(output), " ") | ||
return loadAry[0], nil | ||
} |
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,21 @@ | ||
package system | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestGetUptime(t *testing.T) { | ||
output, err := GetUptime() | ||
if err != nil { | ||
t.Error(err) | ||
} | ||
t.Log(output) | ||
} | ||
|
||
func TestGetLoad(t *testing.T) { | ||
output, err := GetLoad() | ||
if err != nil { | ||
t.Error(err) | ||
} | ||
t.Log(output) | ||
} |
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