adding 'servers' interface to manage multiple servers and support for encrypted configs #16
Loading…
Reference in New Issue
No description provided.
Delete Branch "servers"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
WIP: adding 'servers' interface to manage multiple servers and support for encrypted configsto adding 'servers' interface to manage multiple servers and support for encrypted configs@ -4,11 +4,13 @@ go 1.14
require (
cwtch.im/cwtch v0.8.5
upgrade
@ -13,2 +13,4 @@
golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee
)
replace cwtch.im/cwtch => /home/dan/src/go/src/cwtch.im/cwtch
remove
@ -91,2 +133,3 @@
key, _, err := v1.InitV1Directory(configDir, password)
if err != nil {
log.Errorf("reading config: %v", err)
log.Errorf("Could not create server directory: %s", err)
errors should be lower case
@ -98,0 +183,4 @@
defer config.lock.Unlock()
bytes, _ := json.MarshalIndent(config, "", "\t")
if config.Encrypted {
//settingStore := v1.NewFileStore(config.ConfigDir, config.FilePath, config.key)
?
was testing replacement. worked, deleted
@ -0,0 +15,4 @@
// Unlike a standalone server, server's dirs will be under one "$CwtchDir/servers" and use a cwtch style localID to obscure
// what servers are hosted. Users are of course free to use a default password. This means Config file will be encrypted
// with cwtch/storage/v1/file_enc and monitor files will not be generated
type Servers interface {
Should probable exercise this with a test
added
@ -0,0 +111,4 @@
delete(s.servers, onion)
return err
}
return errors.New("Server not found")
errors should be lower case
@ -0,0 +125,4 @@
// ShutdownServer Shutsdown the specified server
func (s *servers) ShutdownServer(onion string) {
s.servers[onion].Shutdown()
s.servers needs to be locked
@ -26,3 +20,3 @@
func main() {
flagDebug := flag.Bool("debug", false, "Enable debug logging")
flagExportTofu := flag.Bool("exportTofuBundle", false, "Export the tofubundle to a file called tofubundle")
flagExportServer := flag.Bool("exportServerBundle", false, "Export the server bundle to a file called serverbundle")
Note: This is a big enough change to qualift for a v2 release.
@ -0,0 +12,4 @@
const TestServerDesc = "a test Server"
func TestServers(t *testing.T) {
Note: Issue needed to make buildbot run this
@ -5,6 +5,7 @@ pwd
GORACE="haltonerror=1"
go test -race ${1} -coverprofile=server.metrics.cover.out -v ./metrics
go test -race ${1} -coverprofile=server.metrics.cover.out -v ./storage
go test -race ${1} -coverprofile=server.metrics.cover.out -v ./
This file is currently wrong. -coverprofile should be unique per
go test
package run.