adding 'servers' interface to manage multiple servers and support for encrypted configs #16

Merged
dan merged 6 commits from servers into trunk 2021-11-01 16:01:12 +00:00
Owner
No description provided.
dan added 1 commit 2021-10-04 23:22:45 +00:00
dan added 1 commit 2021-10-08 00:11:23 +00:00
dan added 1 commit 2021-10-29 23:01:55 +00:00
dan changed title from WIP: adding 'servers' interface to manage multiple servers and support for encrypted configs to adding 'servers' interface to manage multiple servers and support for encrypted configs 2021-10-29 23:02:39 +00:00
dan added 1 commit 2021-10-29 23:06:23 +00:00
sarah requested changes 2021-10-29 23:54:01 +00:00
sarah left a comment
Owner
  • add quality.sh / run go linting over this
  • couple of map accesses outside of locks
- add quality.sh / run go linting over this - couple of map accesses outside of locks
go.mod Outdated
@ -4,11 +4,13 @@ go 1.14
require (
cwtch.im/cwtch v0.8.5
Owner

upgrade

upgrade
dan marked this conversation as resolved
go.mod Outdated
@ -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
Owner

remove

remove
dan marked this conversation as resolved
serverConfig.go Outdated
@ -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)
Owner

errors should be lower case

errors should be lower case
dan marked this conversation as resolved
@ -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)
Owner

?

?
Author
Owner

was testing replacement. worked, deleted

was testing replacement. worked, deleted
dan marked this conversation as resolved
@ -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 {
Owner

Should probable exercise this with a test

Should probable exercise this with a test
Author
Owner

added

added
dan marked this conversation as resolved
@ -0,0 +111,4 @@
delete(s.servers, onion)
return err
}
return errors.New("Server not found")
Owner

errors should be lower case

errors should be lower case
dan marked this conversation as resolved
servers.go Outdated
@ -0,0 +125,4 @@
// ShutdownServer Shutsdown the specified server
func (s *servers) ShutdownServer(onion string) {
s.servers[onion].Shutdown()
Owner

s.servers needs to be locked

s.servers needs to be locked
dan marked this conversation as resolved
dan added 1 commit 2021-10-30 00:46:40 +00:00
sarah reviewed 2021-10-31 19:20:36 +00:00
@ -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")
Owner

Note: This is a big enough change to qualift for a v2 release.

Note: This is a big enough change to qualift for a v2 release.
sarah reviewed 2021-10-31 19:22:44 +00:00
@ -0,0 +12,4 @@
const TestServerDesc = "a test Server"
func TestServers(t *testing.T) {
Owner

Note: Issue needed to make buildbot run this

Note: Issue needed to make buildbot run this
sarah reviewed 2021-10-31 19:23:36 +00:00
testing/tests.sh Outdated
@ -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 ./
Owner

This file is currently wrong. -coverprofile should be unique per go test package run.

This file is currently wrong. -coverprofile should be unique per `go test` package run.
dan marked this conversation as resolved
sarah approved these changes 2021-10-31 19:23:58 +00:00
dan added 1 commit 2021-11-01 16:00:46 +00:00
dan merged commit c148e120f3 into trunk 2021-11-01 16:01:12 +00:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cwtch.im/server#16
No description provided.