Skip to content
Snippets Groups Projects
main.go 1.11 KiB
Newer Older
// Copyright ©2023 The calorado-daq Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// Command calo-fwd serves an end-point for proxying CALO data.
// calo-fwd listens for commands from calo-daq to transfer data to
// the host of calo-srv.
package main // import "gitlab.in2p3.fr/sbinet/calorado-daq/cmd/calo-fwd"

import (
	"flag"
	"log"
)

func main() {
	log.SetPrefix("calo-fwd: ")
	log.SetFlags(0)

	var (
		addr      = flag.String("addr", ":54242", "[host]:port to serve")
		notify    = flag.String("notify", "clrwebdev02.in2p3.fr:54242", "[addr]:port to send notifications to")
		remote    = flag.String("remote", "root@clrwebdev02.in2p3.fr", "remote host to send data to")
		remoteDir = flag.String("remote-dir", "/home/calorado/data/raw", "remote host directory to send data to")
	)

	flag.Parse()

	srv, err := newServer(*addr, *notify, *remote, *remoteDir)
	if err != nil {
		log.Fatalf("could not create CALO relay server: %+v", err)
	}

	err = srv.run()
	if err != nil {
		log.Fatalf("could not run CALO relay server: %+v", err)
	}
}