mirror of
https://github.com/octoleo/syncthing.git
synced 2025-02-02 11:58:28 +00:00
cmd/relaysrv: Add build stamped version, print at startup
This commit is contained in:
parent
1287433a99
commit
0af216fea0
@ -13,6 +13,7 @@ import (
|
|||||||
"os/signal"
|
"os/signal"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"syscall"
|
"syscall"
|
||||||
@ -26,6 +27,24 @@ import (
|
|||||||
syncthingprotocol "github.com/syncthing/syncthing/lib/protocol"
|
syncthingprotocol "github.com/syncthing/syncthing/lib/protocol"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
Version string
|
||||||
|
BuildStamp string
|
||||||
|
BuildUser string
|
||||||
|
BuildHost string
|
||||||
|
|
||||||
|
BuildDate time.Time
|
||||||
|
LongVersion string
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
stamp, _ := strconv.Atoi(BuildStamp)
|
||||||
|
BuildDate = time.Unix(int64(stamp), 0)
|
||||||
|
|
||||||
|
date := BuildDate.UTC().Format("2006-01-02 15:04:05 MST")
|
||||||
|
LongVersion = fmt.Sprintf(`relaysrv %s (%s %s-%s) %s@%s %s`, Version, runtime.Version(), runtime.GOOS, runtime.GOARCH, BuildUser, BuildHost, date)
|
||||||
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
listen string
|
listen string
|
||||||
debug bool = false
|
debug bool = false
|
||||||
@ -82,6 +101,8 @@ func main() {
|
|||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Println(LongVersion)
|
||||||
|
|
||||||
maxDescriptors, err := osutil.MaximizeOpenFileLimit()
|
maxDescriptors, err := osutil.MaximizeOpenFileLimit()
|
||||||
if maxDescriptors > 0 {
|
if maxDescriptors > 0 {
|
||||||
// Assume that 20% of FD's are leaked/unaccounted for.
|
// Assume that 20% of FD's are leaked/unaccounted for.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user