Skip to content

Commit

Permalink
this name will do
Browse files Browse the repository at this point in the history
  • Loading branch information
BeryJu committed Jul 10, 2022
1 parent 541d4c8 commit dc0f96c
Show file tree
Hide file tree
Showing 53 changed files with 106 additions and 106 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
uses: docker/[email protected]
with:
tags: |
ghcr.io/beryju/ddet:latest
ghcr.io/beryju/gravity:latest
push: ${{ github.ref == 'refs/heads/main' }}
platforms: linux/amd64,linux/arm64
build-args: |
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ RUN go mod download
COPY . .
COPY --from=web-builder /work/web/dist/ /workspace/web/dist/

RUN CGO_ENABLED=0 GOOS=linux go build -v -a -o ddet .
RUN CGO_ENABLED=0 GOOS=linux go build -v -a -o gravity .

# Stage 3: Run
FROM docker.io/library/debian:stable-slim

WORKDIR /

COPY --from=builder /workspace/ddet /app/ddet
COPY --from=builder /workspace/gravity /app/gravity

RUN apt-get update && \
apt-get install -y --no-install-recommends nmap bash && \
Expand All @@ -38,4 +38,4 @@ USER 65532:65532

ENV INSTANCE_LISTEN=0.0.0.0

ENTRYPOINT ["/app/ddet"]
ENTRYPOINT ["/app/gravity"]
6 changes: 3 additions & 3 deletions cmd/addUser.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"fmt"
"syscall"

"beryju.io/ddet/pkg/instance"
"beryju.io/ddet/pkg/roles"
"beryju.io/ddet/pkg/roles/api"
"beryju.io/gravity/pkg/instance"
"beryju.io/gravity/pkg/roles"
"beryju.io/gravity/pkg/roles/api"
"github.com/spf13/cobra"
"golang.org/x/term"
)
Expand Down
4 changes: 2 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import (
"os"
"time"

"beryju.io/ddet/pkg/instance"
"beryju.io/gravity/pkg/instance"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)

var rootCmd = &cobra.Command{
Use: "ddet",
Use: "gravity",
Short: "A brief description of your application",
Run: func(cmd *cobra.Command, args []string) {
rand.Seed(time.Now().Unix())
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module beryju.io/ddet
module beryju.io/gravity

go 1.18

Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package main

import "beryju.io/ddet/cmd"
import "beryju.io/gravity/cmd"

func main() {
cmd.Execute()
Expand Down
2 changes: 1 addition & 1 deletion pkg/extconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type ExtConfig struct {
Debug bool `env:"DEBUG,default=false"`
DataPath string `env:"DATA_PATH,default=./data"`
Etcd struct {
Prefix string `env:"ETCD_PREFIX,default=/ddet"`
Prefix string `env:"ETCD_PREFIX,default=/gravity"`
Endpoint string `env:"ETCD_ENDPOINT,default=localhost:2379"`
JoinCluster string `env:"ETCD_JOIN_CLUSTER"`
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/instance/events.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package instance

import "beryju.io/ddet/pkg/roles"
import "beryju.io/gravity/pkg/roles"

func (i *Instance) dispatchEvent(topic string, ev *roles.Event) {
i.eventHandlersM.RLock()
Expand Down
18 changes: 9 additions & 9 deletions pkg/instance/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import (

log "github.com/sirupsen/logrus"

"beryju.io/ddet/pkg/extconfig"
"beryju.io/ddet/pkg/roles"
"beryju.io/ddet/pkg/roles/api"
"beryju.io/ddet/pkg/roles/backup"
"beryju.io/ddet/pkg/roles/dhcp"
"beryju.io/ddet/pkg/roles/discovery"
"beryju.io/ddet/pkg/roles/dns"
"beryju.io/ddet/pkg/roles/etcd"
"beryju.io/ddet/pkg/storage"
"beryju.io/gravity/pkg/extconfig"
"beryju.io/gravity/pkg/roles"
"beryju.io/gravity/pkg/roles/api"
"beryju.io/gravity/pkg/roles/backup"
"beryju.io/gravity/pkg/roles/dhcp"
"beryju.io/gravity/pkg/roles/discovery"
"beryju.io/gravity/pkg/roles/dns"
"beryju.io/gravity/pkg/roles/etcd"
"beryju.io/gravity/pkg/storage"
)

const (
Expand Down
4 changes: 2 additions & 2 deletions pkg/instance/role_instance.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package instance

import (
"beryju.io/ddet/pkg/roles"
"beryju.io/ddet/pkg/storage"
"beryju.io/gravity/pkg/roles"
"beryju.io/gravity/pkg/storage"
log "github.com/sirupsen/logrus"
)

Expand Down
6 changes: 3 additions & 3 deletions pkg/roles/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"net/http"
"strings"

"beryju.io/ddet/pkg/extconfig"
"beryju.io/ddet/pkg/roles"
"beryju.io/ddet/pkg/roles/api/types"
"beryju.io/gravity/pkg/extconfig"
"beryju.io/gravity/pkg/roles"
"beryju.io/gravity/pkg/roles/api/types"
"github.com/gorilla/mux"
log "github.com/sirupsen/logrus"
"github.com/swaggest/rest/nethttp"
Expand Down
4 changes: 2 additions & 2 deletions pkg/roles/api/middleware_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"
"net/http"

"beryju.io/ddet/pkg/roles/api/types"
"beryju.io/gravity/pkg/roles/api/types"
log "github.com/sirupsen/logrus"
"golang.org/x/crypto/bcrypt"
)
Expand Down Expand Up @@ -32,7 +32,7 @@ func NewAuthMiddleware(r *APIRole) func(h http.Handler) http.Handler {
func (am *AuthMiddleware) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
username, password, ok := r.BasicAuth()
if !ok {
rw.Header().Set("WWW-Authenticate", "Basic realm=ddet")
rw.Header().Set("WWW-Authenticate", "Basic realm=gravity")
http.Error(rw, "missing http basic authentication", http.StatusUnauthorized)
return
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/roles/api/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import (
"io/fs"
"net/http"

"beryju.io/ddet/pkg/extconfig"
"beryju.io/ddet/web"
"beryju.io/gravity/pkg/extconfig"
"beryju.io/gravity/web"
)

//go:embed ui/index.html
var IndexTemplate string

func (r *APIRole) setupUI() {
t, err := template.New("ddet.ui").Parse(IndexTemplate)
t, err := template.New("gravity.ui").Parse(IndexTemplate)
if err != nil {
panic(err)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/roles/api/ui/index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>ddet</title>
<title>gravity</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="/ui/static/style.css">
<script type="module" type="text/javascript" src="/ui/static/main.js"></script>
</head>
<body>
<ddet-app></ddet-app>
<gravity-app></gravity-app>
</body>
</html>
4 changes: 2 additions & 2 deletions pkg/roles/backup/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"strings"
"time"

"beryju.io/ddet/pkg/roles"
"beryju.io/gravity/pkg/roles"
"github.com/minio/minio-go/v7"
"github.com/minio/minio-go/v7/pkg/credentials"
"github.com/robfig/cron/v3"
Expand Down Expand Up @@ -86,7 +86,7 @@ func (r *BackupRole) saveSnapshot() {
return
}
now := time.Now()
fileName := fmt.Sprintf("ddet-snapshot-%d-%d-%d", now.Year(), now.Month(), now.Day())
fileName := fmt.Sprintf("gravity-snapshot-%d-%d-%d", now.Year(), now.Month(), now.Day())
i, err := r.mc.PutObject(r.ctx, r.cfg.Bucket, fileName, read, -1, minio.PutObjectOptions{})
if err != nil {
r.log.WithError(err).Warning("failed to upload snapshot")
Expand Down
4 changes: 2 additions & 2 deletions pkg/roles/dhcp/dhcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"context"
"net"

"beryju.io/ddet/pkg/roles"
"beryju.io/ddet/pkg/roles/dhcp/types"
"beryju.io/gravity/pkg/roles"
"beryju.io/gravity/pkg/roles/dhcp/types"
log "github.com/sirupsen/logrus"

"github.com/insomniacslk/dhcp/dhcpv4/server4"
Expand Down
2 changes: 1 addition & 1 deletion pkg/roles/dhcp/dhcp_handler4.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"net"

"beryju.io/ddet/pkg/extconfig"
"beryju.io/gravity/pkg/extconfig"
"github.com/insomniacslk/dhcp/dhcpv4"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/roles/dhcp/dhcp_handler4_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"net"

"beryju.io/ddet/pkg/roles/dhcp/types"
"beryju.io/gravity/pkg/roles/dhcp/types"
"github.com/insomniacslk/dhcp/dhcpv4"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/roles/dhcp/event_handler.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package dhcp

import (
"beryju.io/ddet/pkg/roles"
"beryju.io/gravity/pkg/roles"
)

func (r *DHCPRole) eventCreateLease(ev *roles.Event) {
Expand Down
8 changes: 4 additions & 4 deletions pkg/roles/dhcp/lease.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import (
"strings"
"time"

"beryju.io/ddet/pkg/extconfig"
"beryju.io/ddet/pkg/roles"
"beryju.io/ddet/pkg/roles/dhcp/types"
"beryju.io/ddet/pkg/roles/dns/utils"
"beryju.io/gravity/pkg/extconfig"
"beryju.io/gravity/pkg/roles"
"beryju.io/gravity/pkg/roles/dhcp/types"
"beryju.io/gravity/pkg/roles/dns/utils"
"github.com/insomniacslk/dhcp/dhcpv4"
"github.com/insomniacslk/dhcp/rfc1035label"
log "github.com/sirupsen/logrus"
Expand Down
6 changes: 3 additions & 3 deletions pkg/roles/dhcp/scopes.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"strings"
"time"

"beryju.io/ddet/pkg/ipam"
"beryju.io/ddet/pkg/roles"
"beryju.io/ddet/pkg/roles/dhcp/types"
"beryju.io/gravity/pkg/ipam"
"beryju.io/gravity/pkg/roles"
"beryju.io/gravity/pkg/roles/dhcp/types"
"github.com/insomniacslk/dhcp/dhcpv4"
log "github.com/sirupsen/logrus"
"go.etcd.io/etcd/api/v3/mvccpb"
Expand Down
2 changes: 1 addition & 1 deletion pkg/roles/dhcp/scopes_watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"strings"
"time"

"beryju.io/ddet/pkg/roles/dhcp/types"
"beryju.io/gravity/pkg/roles/dhcp/types"
"go.etcd.io/etcd/api/v3/mvccpb"
clientv3 "go.etcd.io/etcd/client/v3"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/roles/discovery/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package discovery
import (
"net/http"

"beryju.io/ddet/pkg/roles"
"beryju.io/gravity/pkg/roles"
"github.com/gorilla/mux"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/roles/discovery/api_devices.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"net/http"
"strings"

"beryju.io/ddet/pkg/roles/discovery/types"
"beryju.io/gravity/pkg/roles/discovery/types"
clientv3 "go.etcd.io/etcd/client/v3"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/roles/discovery/api_subnets.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"
"net/http"

"beryju.io/ddet/pkg/roles/discovery/types"
"beryju.io/gravity/pkg/roles/discovery/types"
clientv3 "go.etcd.io/etcd/client/v3"
)

Expand Down
8 changes: 4 additions & 4 deletions pkg/roles/discovery/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"errors"
"strings"

"beryju.io/ddet/pkg/roles"
dhcptypes "beryju.io/ddet/pkg/roles/dhcp/types"
"beryju.io/ddet/pkg/roles/discovery/types"
dnstypes "beryju.io/ddet/pkg/roles/dns/types"
"beryju.io/gravity/pkg/roles"
dhcptypes "beryju.io/gravity/pkg/roles/dhcp/types"
"beryju.io/gravity/pkg/roles/discovery/types"
dnstypes "beryju.io/gravity/pkg/roles/dns/types"
"go.etcd.io/etcd/api/v3/mvccpb"
clientv3 "go.etcd.io/etcd/client/v3"
)
Expand Down
8 changes: 4 additions & 4 deletions pkg/roles/discovery/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package discovery
import (
"context"

"beryju.io/ddet/pkg/extconfig"
"beryju.io/ddet/pkg/roles"
apitypes "beryju.io/ddet/pkg/roles/api/types"
"beryju.io/ddet/pkg/roles/discovery/types"
"beryju.io/gravity/pkg/extconfig"
"beryju.io/gravity/pkg/roles"
apitypes "beryju.io/gravity/pkg/roles/api/types"
"beryju.io/gravity/pkg/roles/discovery/types"

log "github.com/sirupsen/logrus"
)
Expand Down
4 changes: 2 additions & 2 deletions pkg/roles/discovery/subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"encoding/json"
"time"

"beryju.io/ddet/pkg/roles"
"beryju.io/ddet/pkg/roles/discovery/types"
"beryju.io/gravity/pkg/roles"
"beryju.io/gravity/pkg/roles/discovery/types"
"github.com/Ullaakut/nmap/v2"
log "github.com/sirupsen/logrus"
"go.etcd.io/etcd/api/v3/mvccpb"
Expand Down
2 changes: 1 addition & 1 deletion pkg/roles/discovery/subnet_watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package discovery
import (
"time"

"beryju.io/ddet/pkg/roles/discovery/types"
"beryju.io/gravity/pkg/roles/discovery/types"
"go.etcd.io/etcd/api/v3/mvccpb"
clientv3 "go.etcd.io/etcd/client/v3"
)
Expand Down
4 changes: 2 additions & 2 deletions pkg/roles/dns/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"encoding/json"
"net/http"

"beryju.io/ddet/pkg/roles"
"beryju.io/ddet/pkg/roles/dns/types"
"beryju.io/gravity/pkg/roles"
"beryju.io/gravity/pkg/roles/dns/types"
"github.com/gorilla/mux"
)

Expand Down
10 changes: 5 additions & 5 deletions pkg/roles/dns/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import (
"runtime"
"sync"

"beryju.io/ddet/pkg/extconfig"
"beryju.io/ddet/pkg/roles"
apitypes "beryju.io/ddet/pkg/roles/api/types"
dhcptypes "beryju.io/ddet/pkg/roles/dhcp/types"
"beryju.io/ddet/pkg/roles/dns/types"
"beryju.io/gravity/pkg/extconfig"
"beryju.io/gravity/pkg/roles"
apitypes "beryju.io/gravity/pkg/roles/api/types"
dhcptypes "beryju.io/gravity/pkg/roles/dhcp/types"
"beryju.io/gravity/pkg/roles/dns/types"
log "github.com/sirupsen/logrus"

"github.com/miekg/dns"
Expand Down
Loading

0 comments on commit dc0f96c

Please sign in to comment.