Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

Commit

Permalink
Make buffer to run standalone
Browse files Browse the repository at this point in the history
  • Loading branch information
duythinht committed Jan 23, 2017
1 parent a202fb3 commit 6ff609f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
4 changes: 2 additions & 2 deletions chaika/udp_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@ func RunServer() {
go RunMonitor()

courier.Setup()
// Buffer for 4KB
buffer := make([]byte, 32678)

for {
// n, add, err
buffer := make([]byte, 32678)
length, _, err := ServerConn.ReadFromUDP(buffer)

if err != nil {
Expand All @@ -43,6 +42,7 @@ func RunServer() {
log, parseError := ParseLog(buffer[:length])

if parseError != nil {
fmt.Println("Error: ", err)
continue
}

Expand Down
10 changes: 10 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@ package main

import (
"flag"
"fmt"

"github.com/duythinht/chaika/chaika"
"github.com/duythinht/chaika/config"
)

var (
requestVersionInfo *bool
)

func init() {
port := flag.Int64("p", 2435, "Port for agent run on")

Expand All @@ -15,6 +20,7 @@ func init() {

grayHost := flag.String("graylog-host", "localhost", "Default graylog host or domain")
grayPort := flag.Int64("graylog-port", 12201, "Default graylog port")
requestVersionInfo = flag.Bool("version", false, "Version")
flag.Parse()
config.InitConfig(&config.Config{
Port: *port,
Expand All @@ -26,5 +32,9 @@ func init() {
}

func main() {
if *requestVersionInfo {
fmt.Println("v" + VERSION)
return
}
chaika.RunServer()
}
2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package main

const VERSION = "1.4.0"
const VERSION = "1.4.2"

0 comments on commit 6ff609f

Please sign in to comment.