cmd/syncthing, lib/syncthing: Create library utils (ref #4085) (#5871)

This commit is contained in:
Simon Frei
2019-07-23 23:39:20 +02:00
committed by GitHub
parent 7a4c88d4e4
commit 46e72d76b5
3 changed files with 134 additions and 107 deletions

View File

@@ -16,6 +16,8 @@ import (
"sync"
"time"
"github.com/thejerf/suture"
"github.com/syncthing/syncthing/lib/api"
"github.com/syncthing/syncthing/lib/build"
"github.com/syncthing/syncthing/lib/config"
@@ -32,8 +34,6 @@ import (
"github.com/syncthing/syncthing/lib/sha256"
"github.com/syncthing/syncthing/lib/tlsutil"
"github.com/syncthing/syncthing/lib/ur"
"github.com/thejerf/suture"
)
const (
@@ -473,15 +473,3 @@ func (e *controller) Shutdown() {
func (e *controller) ExitUpgrading() {
e.Stop(ExitUpgrade)
}
func LoadCertificate(certFile, keyFile string) (tls.Certificate, error) {
return tls.LoadX509KeyPair(certFile, keyFile)
}
func LoadConfig(path string, cert tls.Certificate) (config.Wrapper, error) {
return config.Load(path, protocol.NewDeviceID(cert.Certificate[0]))
}
func OpenGoleveldb(path string) (*db.Lowlevel, error) {
return db.Open(path)
}