Compare commits

...

5 commits

6 changed files with 13 additions and 30 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
.*.vim .*.vim
/build

View file

@ -54,8 +54,8 @@ func (b *BoolAuto) Set(s string) error {
} }
func main() { func main() {
addr := flag.String("addr", "localhost:9080", "http service address") queryAddr := flag.String("addr", "", "http service address")
querySocket := flag.String("socket", "", "Path to a unix domain socket for the HTTP server") querySocket := flag.String("socket", "/tmp/circologd-query.sock", "Path to a unix domain socket for the HTTP server")
backlogLimit := flag.Int("n", -1, "Limit the backlog length, defaults to no limit (-1)") backlogLimit := flag.Int("n", -1, "Limit the backlog length, defaults to no limit (-1)")
var format formatter.Format var format formatter.Format
format = formatter.FormatSyslog format = formatter.FormatSyslog
@ -75,7 +75,7 @@ func main() {
signal.Notify(interrupt, os.Interrupt) signal.Notify(interrupt, os.Interrupt)
var d *websocket.Dialer var d *websocket.Dialer
u := url.URL{Scheme: "ws", u := url.URL{Scheme: "ws",
Host: *addr, // ignored in case of -socket; see the Dialer below Host: *queryAddr, // ignored in case of -socket; see the Dialer below
Path: "/ws", Path: "/ws",
} }
q := u.Query() q := u.Query()
@ -84,7 +84,7 @@ func main() {
q.Set("l", strconv.Itoa(*backlogLimit)) q.Set("l", strconv.Itoa(*backlogLimit))
} }
u.RawQuery = q.Encode() u.RawQuery = q.Encode()
if *querySocket != "" { if *queryAddr == "" {
d = &websocket.Dialer{ d = &websocket.Dialer{
NetDial: func(network, addr string) (net.Conn, error) { NetDial: func(network, addr string) (net.Conn, error) {
return net.Dial("unix", *querySocket) return net.Dial("unix", *querySocket)
@ -95,7 +95,7 @@ func main() {
log.Printf("connecting to %s", *querySocket) log.Printf("connecting to %s", *querySocket)
} else { } else {
d = websocket.DefaultDialer d = websocket.DefaultDialer
log.Printf("connecting to %s", *addr) log.Printf("connecting to %s", *queryAddr)
} }
c, _, err := d.Dial(u.String(), nil) c, _, err := d.Dial(u.String(), nil)

View file

@ -38,8 +38,8 @@ func main() {
// dumpSocketPath := flag.String("dump-socket", "/run/buffer.sock", "The socket that user will connect to in order to receive logs") // dumpSocketPath := flag.String("dump-socket", "/run/buffer.sock", "The socket that user will connect to in order to receive logs")
bufsize := flag.Int("buffer-size", 1000, "Number of messages to keep") bufsize := flag.Int("buffer-size", 1000, "Number of messages to keep")
syslogAddr := flag.String("syslog-addr", "127.0.0.1:9514", "Address:port where to listen for syslog messages") syslogAddr := flag.String("syslog-addr", "127.0.0.1:9514", "Address:port where to listen for syslog messages")
queryAddr := flag.String("query-addr", "127.0.0.1:9080", "Address:port where to bind the query service") queryAddr := flag.String("query-addr", "", "Address:port where to bind the query service")
querySocket := flag.String("query-socket", "", "Path to a unix domain socket for the HTTP server; recommended for security reasons!") querySocket := flag.String("query-socket", "/tmp/circologd-query.sock", "Path to a unix domain socket for the HTTP server; recommended for security reasons!")
ctlSocket := flag.String("ctl-socket", "/tmp/circologd-ctl.sock", "Path to a unix domain socket for the control server; leave empty to disable") ctlSocket := flag.String("ctl-socket", "/tmp/circologd-ctl.sock", "Path to a unix domain socket for the control server; leave empty to disable")
flag.Var(&logFmt, "log-fmt", "Log messages format. If not set, defaults to automatic choice. Allowed values: rfc3164, rfc5424, auto.") flag.Var(&logFmt, "log-fmt", "Log messages format. If not set, defaults to automatic choice. Allowed values: rfc3164, rfc5424, auto.")
verbose := flag.Bool("verbose", false, "Print more output executing the daemon") verbose := flag.Bool("verbose", false, "Print more output executing the daemon")
@ -89,7 +89,7 @@ func main() {
} }
httpQueryServer := http.Server{Handler: setupHTTP(hub)} httpQueryServer := http.Server{Handler: setupHTTP(hub)}
if *querySocket != "" { if *queryAddr == "" {
fmt.Printf("Binding address `%s` [http]\n", *querySocket) fmt.Printf("Binding address `%s` [http]\n", *querySocket)
unixListener, err := net.Listen("unix", *querySocket) unixListener, err := net.Listen("unix", *querySocket)
if err != nil { if err != nil {

View file

@ -1,13 +0,0 @@
#!/bin/bash
set -u
for goosarch in $(go tool dist list | grep -vw -e aix -e js/wasm -e plan9 -e solaris -e android -e nacl)
do
mkdir -p "build/$goosarch"
goos=$(cut -d/ -f 1 <<<$goosarch)
goarch=$(cut -d/ -f 2 <<<$goosarch)
for cmd in cmd/*; do
GOOS=${goos} GOARCH=${goarch} go build -o "build/$goos/$goarch/$(basename $cmd)" ./$cmd
done
done

View file

@ -1,8 +0,0 @@
#!/bin/bash
find build/ -type f|cut -d/ -f 1-3|uniq|while read -r dir; do
zip -j -r "circolog-$(git describe)-$(cut -d/ -f 2-3 <<<"$dir"|tr / -)" "$dir"
done
wait

View file

@ -13,5 +13,8 @@ do
done done
find build/ -type f|cut -d/ -f 1-3|uniq|while read -r dir; do find build/ -type f|cut -d/ -f 1-3|uniq|while read -r dir; do
zip -j -r "circolog-$(git describe)-$(cut -d/ -f 2-3 <<<"$dir"|tr / -)" "$dir" find $dir/ -type f -executable | xargs sha1sum > $dir/SHA1SUMS.txt
# TODO: touch to last commit date maybe
find build -exec touch -d @1234567890 {} \;
zip -q -X -j -r "circolog-$(git describe --tags --always)-$(cut -d/ -f 2-3 <<<"$dir"|tr / -)" "$dir"
done done