Skip to content

Commit

Permalink
#30 move go code into server directory
Browse files Browse the repository at this point in the history
  • Loading branch information
fxnn committed Nov 16, 2019
1 parent 4b71187 commit 0fef190
Show file tree
Hide file tree
Showing 42 changed files with 65 additions and 65 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ matrix:
# HINT: this is only for interest -- decision to support new versions is made manually

before_install:
- go get -t -v ./...
- go get -t -v ./server/...
- go get github.com/pierrre/gotestcover

script:
# webapp build
- npm -C webapp install && npm -C webapp run build
# do regular coverage
- gotestcover -v -covermode=count -coverprofile=coverage.intrapackage.txt ./...
- gotestcover -v -covermode=count -coverprofile=coverage.intrapackage.txt ./server/...
# do coverage for all packages and tests in `it` package
- go test -covermode=count -coverprofile=coverage.it.txt -coverpkg=./... ./it
- go test -covermode=count -coverprofile=coverage.it.txt -coverpkg=./server/... ./server/it
# HINT: report merging is done by codecov.io script

after_success:
Expand Down
4 changes: 2 additions & 2 deletions application/config.go → server/application/config.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package application

import (
"github.com/fxnn/deadbox/config"
"github.com/fxnn/deadbox/crypto"
"github.com/fxnn/deadbox/server/config"
"github.com/fxnn/deadbox/server/crypto"
)

func ReadConfig() *config.Application {
Expand Down
4 changes: 2 additions & 2 deletions application/crypto.go → server/application/crypto.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"os"
"time"

"github.com/fxnn/deadbox/crypto"
"github.com/fxnn/deadbox/rest"
"github.com/fxnn/deadbox/server/crypto"
"github.com/fxnn/deadbox/server/rest"
)

func ReadOrCreateTLSCertFiles(
Expand Down
2 changes: 1 addition & 1 deletion application/database.go → server/application/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"time"

"github.com/boltdb/bolt"
"github.com/fxnn/deadbox/config"
"github.com/fxnn/deadbox/server/config"
)

func OpenDb(cfg *config.Application, name string) *bolt.DB {
Expand Down
2 changes: 1 addition & 1 deletion application/file.go → server/application/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package application
import (
"path/filepath"

"github.com/fxnn/deadbox/config"
"github.com/fxnn/deadbox/server/config"
)

const (
Expand Down
12 changes: 6 additions & 6 deletions cmd/deadbox.go → server/cmd/deadbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import (
"os/signal"
"syscall"

"github.com/fxnn/deadbox/application"
"github.com/fxnn/deadbox/config"
"github.com/fxnn/deadbox/crypto"
"github.com/fxnn/deadbox/daemon"
"github.com/fxnn/deadbox/drop"
"github.com/fxnn/deadbox/worker"
"github.com/fxnn/deadbox/server/application"
"github.com/fxnn/deadbox/server/config"
"github.com/fxnn/deadbox/server/crypto"
"github.com/fxnn/deadbox/server/daemon"
"github.com/fxnn/deadbox/server/drop"
"github.com/fxnn/deadbox/server/worker"
)

func main() {
Expand Down
File renamed without changes.
File renamed without changes.
14 changes: 7 additions & 7 deletions config/dummy.go → server/config/dummy.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import "net/url"
func Dummy() *Application {
dropUrl, _ := url.Parse("https://localhost:" + DefaultPort)
w := Worker{
Name: "Default Worker",
DropUrl: dropUrl,
Name: "Default Worker",
DropUrl: dropUrl,
UpdateRegistrationIntervalInSeconds: DefaultUpdateRegistrationIntervalInSeconds,
RegistrationTimeoutInSeconds: DefaultRegistrationTimeoutInSeconds,
PrivateKeySize: DefaultPrivateKeySize,
Expand All @@ -20,11 +20,11 @@ func Dummy() *Application {
CertificateValidFor: DefaultCertificateValidFor,
}
app := &Application{
DbPath: "./",
PrivateKeyPath: "./",
CertPath: "./",
Workers: []Worker{w},
Drops: []Drop{d},
DbPath: "./",
PrivateKeyPath: "./",
CertPath: "./",
Workers: []Worker{w},
Drops: []Drop{d},
PublicKeyFingerprintChallengeLevel: DefaultPublicKeyFingerprintChallengeLevel,
PublicKeyFingerprintLength: DefaultPublicKeyFingerprintLength,
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion crypto/request.go → server/crypto/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"fmt"
"strings"

"github.com/fxnn/deadbox/model"
"github.com/fxnn/deadbox/server/model"
)

const (
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions drop/facade.go → server/drop/facade.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"time"

"github.com/boltdb/bolt"
"github.com/fxnn/deadbox/config"
"github.com/fxnn/deadbox/daemon"
"github.com/fxnn/deadbox/model"
"github.com/fxnn/deadbox/rest"
"github.com/fxnn/deadbox/server/config"
"github.com/fxnn/deadbox/server/daemon"
"github.com/fxnn/deadbox/server/model"
"github.com/fxnn/deadbox/server/rest"
)

type Daemonized interface {
Expand Down
2 changes: 1 addition & 1 deletion drop/requests.go → server/drop/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"time"

"github.com/boltdb/bolt"
"github.com/fxnn/deadbox/model"
"github.com/fxnn/deadbox/server/model"
)

type requests struct {
Expand Down
2 changes: 1 addition & 1 deletion drop/responses.go → server/drop/responses.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"time"

"github.com/boltdb/bolt"
"github.com/fxnn/deadbox/model"
"github.com/fxnn/deadbox/server/model"
"github.com/fxnn/gone/log"
)

Expand Down
2 changes: 1 addition & 1 deletion drop/tx.go → server/drop/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"

"github.com/boltdb/bolt"
"github.com/fxnn/deadbox/model"
"github.com/fxnn/deadbox/server/model"
)

const responseBucketName = "request"
Expand Down
2 changes: 1 addition & 1 deletion drop/workers.go → server/drop/workers.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"time"

"github.com/boltdb/bolt"
"github.com/fxnn/deadbox/model"
"github.com/fxnn/deadbox/server/model"
"github.com/fxnn/gone/log"
)

Expand Down
2 changes: 1 addition & 1 deletion drop/workers_test.go → server/drop/workers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"time"

"github.com/boltdb/bolt"
"github.com/fxnn/deadbox/model"
"github.com/fxnn/deadbox/server/model"
)

const testDbFilename = "./test.boltdb"
Expand Down
2 changes: 1 addition & 1 deletion go.mod → server/go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/fxnn/deadbox
module github.com/fxnn/deadbox/server

go 1.13

Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions it/request_test.go → server/it/request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"encoding/json"
"fmt"

"github.com/fxnn/deadbox/crypto"
"github.com/fxnn/deadbox/model"
"github.com/fxnn/deadbox/request/echo"
"github.com/fxnn/deadbox/server/crypto"
"github.com/fxnn/deadbox/server/model"
"github.com/fxnn/deadbox/server/request/echo"
)

const (
Expand Down
18 changes: 9 additions & 9 deletions it/utils_test.go → server/it/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import (
"time"

"github.com/boltdb/bolt"
"github.com/fxnn/deadbox/config"
"github.com/fxnn/deadbox/crypto"
"github.com/fxnn/deadbox/daemon"
"github.com/fxnn/deadbox/drop"
"github.com/fxnn/deadbox/model"
"github.com/fxnn/deadbox/rest"
"github.com/fxnn/deadbox/worker"
"github.com/fxnn/deadbox/server/config"
"github.com/fxnn/deadbox/server/crypto"
"github.com/fxnn/deadbox/server/daemon"
"github.com/fxnn/deadbox/server/drop"
"github.com/fxnn/deadbox/server/model"
"github.com/fxnn/deadbox/server/rest"
"github.com/fxnn/deadbox/server/worker"
)

const (
Expand Down Expand Up @@ -118,8 +118,8 @@ func runWorkerDaemon(t *testing.T) (worker.Daemonized, []byte) {
t.Helper()

cfg := &config.Worker{
Name: workerName,
DropUrl: parseUrlOrPanic("http://localhost:" + port),
Name: workerName,
DropUrl: parseUrlOrPanic("http://localhost:" + port),
RegistrationTimeoutInSeconds: config.DefaultRegistrationTimeoutInSeconds,
UpdateRegistrationIntervalInSeconds: config.DefaultUpdateRegistrationIntervalInSeconds,
}
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion request/echo/echo.go → server/request/echo/echo.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package echo

import (
"github.com/fxnn/deadbox/request"
"github.com/fxnn/deadbox/server/request"
)

const interfaceVersion = "1.0"
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions rest/client.go → server/rest/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"net/http"
"net/url"

"github.com/fxnn/deadbox/crypto"
"github.com/fxnn/deadbox/model"
"github.com/fxnn/deadbox/server/crypto"
"github.com/fxnn/deadbox/server/model"
)

// client implements a REST client to a drop server.
Expand Down
2 changes: 1 addition & 1 deletion rest/router.go → server/rest/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"net/http"

"github.com/fxnn/deadbox/model"
"github.com/fxnn/deadbox/server/model"
"github.com/gorilla/mux"
)

Expand Down
2 changes: 1 addition & 1 deletion rest/router_test.go → server/rest/router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"net/http/httptest"
"testing"

"github.com/fxnn/deadbox/model"
"github.com/fxnn/deadbox/server/model"
)

func TestGetAllWorkers(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion rest/server.go → server/rest/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"context"

"github.com/fxnn/deadbox/model"
"github.com/fxnn/deadbox/server/model"
)

type Server struct {
Expand Down
File renamed without changes.
16 changes: 8 additions & 8 deletions worker/facade.go → server/worker/facade.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import (
"log"

"github.com/boltdb/bolt"
"github.com/fxnn/deadbox/config"
"github.com/fxnn/deadbox/crypto"
"github.com/fxnn/deadbox/daemon"
"github.com/fxnn/deadbox/model"
"github.com/fxnn/deadbox/rest"
"github.com/fxnn/deadbox/server/config"
"github.com/fxnn/deadbox/server/crypto"
"github.com/fxnn/deadbox/server/daemon"
"github.com/fxnn/deadbox/server/model"
"github.com/fxnn/deadbox/server/rest"
)

const pollRequestInterval = 1 * time.Second
Expand Down Expand Up @@ -47,9 +47,9 @@ func New(c *config.Worker, id string, db *bolt.DB, privateKey *rsa.PrivateKey, f
privateKey: privateKey,
updateRegistrationInterval: time.Duration(c.UpdateRegistrationIntervalInSeconds) * time.Second,
registrations: registrations{
id: model.WorkerId(id),
drop: drop,
name: c.Name,
id: model.WorkerId(id),
drop: drop,
name: c.Name,
registrationTimeoutDuration: time.Duration(c.RegistrationTimeoutInSeconds) * time.Second,
},
requests: requests{
Expand Down
6 changes: 3 additions & 3 deletions worker/processors.go → server/worker/processors.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package worker

import (
"github.com/fxnn/deadbox/config"
"github.com/fxnn/deadbox/request"
"github.com/fxnn/deadbox/request/echo"
"github.com/fxnn/deadbox/server/config"
"github.com/fxnn/deadbox/server/request"
"github.com/fxnn/deadbox/server/request/echo"
)

type requestProcessors struct {
Expand Down
2 changes: 1 addition & 1 deletion worker/registrations.go → server/worker/registrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"fmt"

"github.com/fxnn/deadbox/model"
"github.com/fxnn/deadbox/server/model"
)

type registrations struct {
Expand Down
4 changes: 2 additions & 2 deletions worker/requests.go → server/worker/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (

"encoding/json"

"github.com/fxnn/deadbox/crypto"
"github.com/fxnn/deadbox/model"
"github.com/fxnn/deadbox/server/crypto"
"github.com/fxnn/deadbox/server/model"
)

const contentTypePlainText = "text/plain"
Expand Down

0 comments on commit 0fef190

Please sign in to comment.