gosync/main.go

29 lines
686 B
Go

package main
import (
"os"
"time"
"velvettear/gosync/log"
"velvettear/gosync/settings"
"velvettear/gosync/tools"
)
func main() {
timestamp := time.Now()
settings.Initialize()
log.Info("starting gosync...")
error := tools.TestConnection()
if error != nil {
if len(settings.Password) == 0 {
log.Warning("could not connect to the remote target, make sure passwordless login is configured or supply a password")
}
log.Fatal("encountered an error connecting to the remote target", error.Error())
}
tools.Transfer()
exit(timestamp, 0)
}
func exit(timestamp time.Time, code int) {
log.InfoTimed("gosync finished - exiting...", timestamp.UnixMilli())
os.Exit(code)
}