-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.go
More file actions
37 lines (31 loc) · 914 Bytes
/
main.go
File metadata and controls
37 lines (31 loc) · 914 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main
import (
"flag"
"fmt"
"os"
"time"
"github.com/asmith030/go-clamav-rest/server"
"github.com/sirupsen/logrus"
)
var (
host = flag.String("host", "localhost", "Address of the clamd instance")
port = flag.Int("port", 3310, "TCP port of the clamd instance")
listenPort = flag.Int("listenPort", 8080, "TCP port that we should listen on")
maxFileMem = flag.Int64("maxFileMem", 128, "Maximum memory used to store uploaded files (excess is written to disk)")
)
func newLogger() *logrus.Logger {
var logger = logrus.New()
logger.Out = os.Stderr
jsonFormatter := new(logrus.JSONFormatter)
jsonFormatter.TimestampFormat = time.RFC3339Nano
logger.Formatter = jsonFormatter
logger.Level = logrus.InfoLevel
return logger
}
func main() {
flag.Parse()
logger := newLogger()
server.RunHTTPListener(
fmt.Sprintf("tcp://%v:%d", *host, *port),
*listenPort, *maxFileMem, logger)
}