Skip to content

Commit

Permalink
01) remove dead code and address #22
Browse files Browse the repository at this point in the history
  • Loading branch information
seantcanavan committed Feb 16, 2017
1 parent a43bb34 commit cba7691
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 47 deletions.
2 changes: 0 additions & 2 deletions loader/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import (
"github.com/seantcanavan/anon-eth-net/logger"
)

const TIME_BETWEEN_SUCCESSIVE_ITERATIONS = 60

// Loader represents a struct that will load a set of processes and watch over
// them. It knows the name of every process that it should be keeping an eye on
// as well as how to resurrect that process should it no longer be executing.
Expand Down
2 changes: 1 addition & 1 deletion main/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func main() {
os.Exit(1)
}

//------------------ CREATE REST INSTANCE TO ENABLE COMMUNIATION VIA REST ------------------
//------------------ CREATE REST INSTANCE TO ENABLE COMMUNICATION VIA REST ------------------
certPath, certPathErr := utils.AssetPath("server.cert")
if certPathErr != nil {
fmt.Println(certPathErr)
Expand Down
26 changes: 0 additions & 26 deletions profiler/profiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"fmt"
"os"
"time"
// "runtime"

"github.com/seantcanavan/anon-eth-net/config"
"github.com/seantcanavan/anon-eth-net/loader"
Expand All @@ -16,12 +15,6 @@ import (
"github.com/seantcanavan/anon-eth-net/utils"
)

// the text to print after we finish executing a command so successive commands have some kind of visual break
const END_COMMAND_DIVIDER = "------------------------------------------------------------\n\n"

// prof is short for profile and is the file extension we use after generating full system profiles
const PROFILE_FILE_EXTENSION = ".prof"

// the subject of the email that we use when sending out the profile
const PROFILE_EMAIL_SUBJECT = "System Profile"

Expand Down Expand Up @@ -131,19 +124,6 @@ func SendArchiveProfileAsAttachment() (*os.File, error) {
return filePtr, reporter.SendAttachment(generateEmailSubject(), generateEmailBody(), filePtr)
}

func beautifyTitle(title string) []byte {
var titleBuffer bytes.Buffer

titleBuffer.WriteString("-------------------- ")
titleBuffer.WriteString(title)
titleBuffer.WriteString(" ")
for titleBuffer.Len() < 60 {
titleBuffer.WriteString("-")
}

return titleBuffer.Bytes()
}

func generateEmailSubject() string {
var buf bytes.Buffer
buf.WriteString(PROFILE_EMAIL_SUBJECT)
Expand All @@ -159,19 +139,13 @@ func generateEmailBody() []byte {
}

func Run() {

// kick off the system profiler loop to send out system profiles at the specified interval
go func() {

for 1 == 1 {

logger.Lgr.LogMessage("Sleeping for %d seconds before sending a system profile", config.Cfg.CheckInFrequencySeconds)
time.Sleep(time.Duration(config.Cfg.CheckInFrequencySeconds) * time.Second)
logger.Lgr.LogMessage("Sending archive to provided email after sleeping %d seconds", config.Cfg.CheckInFrequencySeconds)
SendArchiveProfileAsAttachment()

}

}()

}
1 change: 0 additions & 1 deletion reporter/reporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ func TestMain(m *testing.M) {
}

result := m.Run()
// flush logs
os.Exit(result)
}

Expand Down
1 change: 0 additions & 1 deletion rest/rest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ var nowString string
var protocol string
var host string
var port string
var publicKey string
var transport *http.Transport
var client *http.Client
var restHandler *RestHandler
Expand Down
16 changes: 0 additions & 16 deletions utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,22 +125,6 @@ func ReadLines(path string) ([]string, error) {
return lines, scanner.Err()
}

// DirectoryList returns a list of entries in the given directory. It filters
// optionally for the given filter.
func DirectoryList(directoryName string, filter string) []string {
fileList := []string{}
_ = filepath.Walk(directoryName, func(path string, f os.FileInfo, err error) error {
if filter != "" {
if strings.Contains(path, filter) {
fileList = append(fileList, path)
}
}
return nil
})

return fileList
}

// credit to: https://gist.github.com/jniltinho/9788121
func ExternalIPAddress() (string, error) {

Expand Down

0 comments on commit cba7691

Please sign in to comment.