replaced git.debros.io with github.com

This commit is contained in:
anonpenguin23 2025-09-18 15:27:53 +03:00
parent 82187de96c
commit ff3b15108d
29 changed files with 233 additions and 213 deletions

View File

@ -11,7 +11,7 @@ Thanks for helping improve the network! This guide covers setup, local dev, test
## Setup
```bash
git clone https://git.debros.io/DeBros/network.git
git clone https://github.com/DeBrosOfficial/network.git
cd network
make deps
```

View File

@ -33,7 +33,7 @@ build: deps
go build -ldflags "$(LDFLAGS)" -o bin/node ./cmd/node
go build -ldflags "$(LDFLAGS)" -o bin/network-cli cmd/cli/main.go
# Inject gateway build metadata via pkg path variables
go build -ldflags "$(LDFLAGS) -X 'git.debros.io/DeBros/network/pkg/gateway.BuildVersion=$(VERSION)' -X 'git.debros.io/DeBros/network/pkg/gateway.BuildCommit=$(COMMIT)' -X 'git.debros.io/DeBros/network/pkg/gateway.BuildTime=$(DATE)'" -o bin/gateway ./cmd/gateway
go build -ldflags "$(LDFLAGS) -X 'github.com/DeBrosOfficial/network/pkg/gateway.BuildVersion=$(VERSION)' -X 'github.com/DeBrosOfficial/network/pkg/gateway.BuildCommit=$(COMMIT)' -X 'github.com/DeBrosOfficial/network/pkg/gateway.BuildTime=$(DATE)'" -o bin/gateway ./cmd/gateway
@echo "Build complete! Run ./bin/network-cli version"
# Clean build artifacts

View File

@ -94,7 +94,7 @@ A robust, decentralized peer-to-peer network built in Go, providing distributed
### 1. Clone and Setup
```bash
git clone https://git.debros.io/DeBros/network.git
git clone https://github.com/DeBrosOfficial/network.git
cd network
```
@ -138,7 +138,7 @@ go run ./cmd/node --config configs/node.yaml
Run the install script for a secure, production-ready setup:
```bash
curl -sSL https://git.debros.io/DeBros/network/raw/branch/main/scripts/install-debros-network.sh | sudo bash
curl -sSL https://github.com/DeBrosOfficial/network/raw/branch/main/scripts/install-debros-network.sh | sudo bash
```
**What the Script Does:**

View File

@ -12,9 +12,9 @@ import (
"strings"
"time"
"git.debros.io/DeBros/network/pkg/anyoneproxy"
"git.debros.io/DeBros/network/pkg/auth"
"git.debros.io/DeBros/network/pkg/client"
"github.com/DeBrosOfficial/network/pkg/anyoneproxy"
"github.com/DeBrosOfficial/network/pkg/auth"
"github.com/DeBrosOfficial/network/pkg/client"
"github.com/libp2p/go-libp2p/core/crypto"
"github.com/libp2p/go-libp2p/core/peer"
)

View File

@ -5,8 +5,8 @@ import (
"os"
"strings"
"git.debros.io/DeBros/network/pkg/gateway"
"git.debros.io/DeBros/network/pkg/logging"
"github.com/DeBrosOfficial/network/pkg/gateway"
"github.com/DeBrosOfficial/network/pkg/logging"
"go.uber.org/zap"
)

View File

@ -9,8 +9,8 @@ import (
"syscall"
"time"
"git.debros.io/DeBros/network/pkg/gateway"
"git.debros.io/DeBros/network/pkg/logging"
"github.com/DeBrosOfficial/network/pkg/gateway"
"github.com/DeBrosOfficial/network/pkg/logging"
"go.uber.org/zap"
)

View File

@ -11,10 +11,10 @@ import (
"path/filepath"
"syscall"
"git.debros.io/DeBros/network/pkg/anyoneproxy"
"git.debros.io/DeBros/network/pkg/config"
"git.debros.io/DeBros/network/pkg/logging"
"git.debros.io/DeBros/network/pkg/node"
"github.com/DeBrosOfficial/network/pkg/anyoneproxy"
"github.com/DeBrosOfficial/network/pkg/config"
"github.com/DeBrosOfficial/network/pkg/logging"
"github.com/DeBrosOfficial/network/pkg/node"
"go.uber.org/zap"
"gopkg.in/yaml.v3"
)

View File

@ -10,7 +10,7 @@ import (
"testing"
"time"
"git.debros.io/DeBros/network/pkg/client"
"github.com/DeBrosOfficial/network/pkg/client"
)
func getenv(k, def string) string {
@ -42,7 +42,9 @@ func TestClient_Database_CreateQueryMigrate(t *testing.T) {
var peers []string
for _, p := range parts {
p = strings.TrimSpace(p)
if p != "" { peers = append(peers, p) }
if p != "" {
peers = append(peers, p)
}
}
cfg.BootstrapPeers = peers
}
@ -52,9 +54,13 @@ func TestClient_Database_CreateQueryMigrate(t *testing.T) {
}
c, err := client.NewClient(cfg)
if err != nil { t.Fatalf("new client: %v", err) }
if err := c.Connect(); err != nil { t.Fatalf("connect: %v", err) }
t.Cleanup(func(){ _ = c.Disconnect() })
if err != nil {
t.Fatalf("new client: %v", err)
}
if err := c.Connect(); err != nil {
t.Fatalf("connect: %v", err)
}
t.Cleanup(func() { _ = c.Disconnect() })
// Unique table per run
table := fmt.Sprintf("e2e_items_client_%d", time.Now().UnixNano())
@ -78,6 +84,10 @@ func TestClient_Database_CreateQueryMigrate(t *testing.T) {
ctx3, cancel3 := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel3()
res, err := c.Database().Query(ctx3, fmt.Sprintf("SELECT name FROM %s ORDER BY id", table))
if err != nil { t.Fatalf("query: %v", err) }
if res.Count < 2 { t.Fatalf("expected at least 2 rows, got %d", res.Count) }
if err != nil {
t.Fatalf("query: %v", err)
}
if res.Count < 2 {
t.Fatalf("expected at least 2 rows, got %d", res.Count)
}
}

View File

@ -5,7 +5,7 @@ import (
"log"
"time"
"git.debros.io/DeBros/network/pkg/client"
"github.com/DeBrosOfficial/network/pkg/client"
)
func main() {

2
go.mod
View File

@ -1,4 +1,4 @@
module git.debros.io/DeBros/network
module github.com/DeBrosOfficial/network
go 1.23.8

View File

@ -20,8 +20,8 @@ import (
libp2ppubsub "github.com/libp2p/go-libp2p-pubsub"
"git.debros.io/DeBros/network/pkg/anyoneproxy"
"git.debros.io/DeBros/network/pkg/pubsub"
"github.com/DeBrosOfficial/network/pkg/anyoneproxy"
"github.com/DeBrosOfficial/network/pkg/pubsub"
)
// Client implements the NetworkClient interface

View File

@ -6,7 +6,7 @@ import (
"encoding/json"
"testing"
"git.debros.io/DeBros/network/pkg/pubsub"
"github.com/DeBrosOfficial/network/pkg/pubsub"
)
// MakeJWT creates a minimal JWT-like token with a json payload

View File

@ -3,7 +3,7 @@ package client
import (
"context"
"git.debros.io/DeBros/network/pkg/pubsub"
"github.com/DeBrosOfficial/network/pkg/pubsub"
)
// contextKey for internal operations

View File

@ -5,7 +5,7 @@ import (
"strconv"
"strings"
"git.debros.io/DeBros/network/pkg/config"
"github.com/DeBrosOfficial/network/pkg/config"
"github.com/multiformats/go-multiaddr"
)

View File

@ -7,7 +7,7 @@ import (
"sync"
"time"
"git.debros.io/DeBros/network/pkg/anyoneproxy"
"github.com/DeBrosOfficial/network/pkg/anyoneproxy"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/multiformats/go-multiaddr"
"github.com/rqlite/gorqlite"

View File

@ -4,7 +4,7 @@ import (
"context"
"fmt"
"git.debros.io/DeBros/network/pkg/pubsub"
"github.com/DeBrosOfficial/network/pkg/pubsub"
)
// pubSubBridge bridges between our PubSubClient interface and the pubsub package

View File

@ -15,7 +15,7 @@ import (
"github.com/rqlite/gorqlite"
"go.uber.org/zap"
"git.debros.io/DeBros/network/pkg/config"
"github.com/DeBrosOfficial/network/pkg/config"
)
// RQLiteManager manages an RQLite node instance

View File

@ -7,7 +7,7 @@ import (
"net/http"
"strings"
"git.debros.io/DeBros/network/pkg/storage"
"github.com/DeBrosOfficial/network/pkg/storage"
)
// appsHandler implements minimal CRUD for apps within a namespace.
@ -29,7 +29,9 @@ func (g *Gateway) appsHandler(w http.ResponseWriter, r *http.Request) {
ns = s
}
}
if strings.TrimSpace(ns) == "" { ns = "default" }
if strings.TrimSpace(ns) == "" {
ns = "default"
}
db := g.client.Database()
nsID, err := g.resolveNamespaceID(ctx, ns)
if err != nil {

View File

@ -11,8 +11,8 @@ import (
"strings"
"time"
"git.debros.io/DeBros/network/pkg/client"
"git.debros.io/DeBros/network/pkg/storage"
"github.com/DeBrosOfficial/network/pkg/client"
"github.com/DeBrosOfficial/network/pkg/storage"
ethcrypto "github.com/ethereum/go-ethereum/crypto"
)

View File

@ -3,7 +3,7 @@ package gateway
import (
"context"
"git.debros.io/DeBros/network/pkg/client"
"github.com/DeBrosOfficial/network/pkg/client"
)
func (g *Gateway) resolveNamespaceID(ctx context.Context, ns string) (interface{}, error) {

View File

@ -8,9 +8,8 @@ import (
"strconv"
"time"
"git.debros.io/DeBros/network/pkg/client"
"git.debros.io/DeBros/network/pkg/logging"
"github.com/DeBrosOfficial/network/pkg/client"
"github.com/DeBrosOfficial/network/pkg/logging"
"go.uber.org/zap"
)

View File

@ -9,9 +9,9 @@ import (
"strings"
"time"
"git.debros.io/DeBros/network/pkg/client"
"git.debros.io/DeBros/network/pkg/logging"
"git.debros.io/DeBros/network/pkg/storage"
"github.com/DeBrosOfficial/network/pkg/client"
"github.com/DeBrosOfficial/network/pkg/logging"
"github.com/DeBrosOfficial/network/pkg/storage"
"go.uber.org/zap"
)

View File

@ -9,8 +9,8 @@ import (
"strconv"
"strings"
"git.debros.io/DeBros/network/pkg/client"
"git.debros.io/DeBros/network/pkg/logging"
"github.com/DeBrosOfficial/network/pkg/client"
"github.com/DeBrosOfficial/network/pkg/logging"
"go.uber.org/zap"
)

View File

@ -1,15 +1,15 @@
package gateway
import (
"encoding/base64"
"encoding/json"
"crypto/sha256"
"encoding/base64"
"encoding/hex"
"encoding/json"
"net/http"
"time"
"git.debros.io/DeBros/network/pkg/client"
"git.debros.io/DeBros/network/pkg/storage"
"github.com/DeBrosOfficial/network/pkg/client"
"github.com/DeBrosOfficial/network/pkg/storage"
"github.com/gorilla/websocket"
)
@ -30,7 +30,7 @@ func (g *Gateway) pubsubWebsocketHandler(w http.ResponseWriter, r *http.Request)
return
}
if r.Method != http.MethodGet {
g.logger.ComponentWarn("gateway", "pubsub ws: method not allowed",)
g.logger.ComponentWarn("gateway", "pubsub ws: method not allowed")
writeError(w, http.StatusMethodNotAllowed, "method not allowed")
return
}
@ -51,7 +51,7 @@ func (g *Gateway) pubsubWebsocketHandler(w http.ResponseWriter, r *http.Request)
}
conn, err := wsUpgrader.Upgrade(w, r, nil)
if err != nil {
g.logger.ComponentWarn("gateway", "pubsub ws: upgrade failed",)
g.logger.ComponentWarn("gateway", "pubsub ws: upgrade failed")
return
}
defer conn.Close()
@ -79,7 +79,7 @@ func (g *Gateway) pubsubWebsocketHandler(w http.ResponseWriter, r *http.Request)
}
}
if err := g.client.PubSub().Subscribe(ctx, topic, h); err != nil {
g.logger.ComponentWarn("gateway", "pubsub ws: subscribe failed",)
g.logger.ComponentWarn("gateway", "pubsub ws: subscribe failed")
writeError(w, http.StatusInternalServerError, err.Error())
return
}

View File

@ -5,8 +5,8 @@ import (
"net/http"
"time"
"git.debros.io/DeBros/network/pkg/client"
"git.debros.io/DeBros/network/pkg/logging"
"github.com/DeBrosOfficial/network/pkg/client"
"github.com/DeBrosOfficial/network/pkg/logging"
"go.uber.org/zap"
)

View File

@ -4,29 +4,32 @@ import (
"encoding/json"
"net/http"
"git.debros.io/DeBros/network/pkg/client"
"git.debros.io/DeBros/network/pkg/pubsub"
"github.com/DeBrosOfficial/network/pkg/client"
"github.com/DeBrosOfficial/network/pkg/pubsub"
)
// Database HTTP handlers
func (g *Gateway) dbQueryHandler(w http.ResponseWriter, r *http.Request) {
if g.client == nil {
writeError(w, http.StatusServiceUnavailable, "client not initialized");
writeError(w, http.StatusServiceUnavailable, "client not initialized")
return
}
if r.Method != http.MethodPost {
writeError(w, http.StatusMethodNotAllowed, "method not allowed");
writeError(w, http.StatusMethodNotAllowed, "method not allowed")
return
}
var body struct{ SQL string `json:"sql"`; Args []any `json:"args"` }
var body struct {
SQL string `json:"sql"`
Args []any `json:"args"`
}
if err := json.NewDecoder(r.Body).Decode(&body); err != nil || body.SQL == "" {
writeError(w, http.StatusBadRequest, "invalid body: {sql, args?}");
writeError(w, http.StatusBadRequest, "invalid body: {sql, args?}")
return
}
ctx := client.WithInternalAuth(r.Context())
res, err := g.client.Database().Query(ctx, body.SQL, body.Args...)
if err != nil {
writeError(w, http.StatusInternalServerError, err.Error());
writeError(w, http.StatusInternalServerError, err.Error())
return
}
writeJSON(w, http.StatusOK, res)
@ -34,39 +37,41 @@ func (g *Gateway) dbQueryHandler(w http.ResponseWriter, r *http.Request) {
func (g *Gateway) dbTransactionHandler(w http.ResponseWriter, r *http.Request) {
if g.client == nil {
writeError(w, http.StatusServiceUnavailable, "client not initialized");
writeError(w, http.StatusServiceUnavailable, "client not initialized")
return
}
if r.Method != http.MethodPost {
writeError(w, http.StatusMethodNotAllowed, "method not allowed");
writeError(w, http.StatusMethodNotAllowed, "method not allowed")
return
}
var body struct{ Statements []string `json:"statements"` }
var body struct {
Statements []string `json:"statements"`
}
if err := json.NewDecoder(r.Body).Decode(&body); err != nil || len(body.Statements) == 0 {
writeError(w, http.StatusBadRequest, "invalid body: {statements:[...]}");
writeError(w, http.StatusBadRequest, "invalid body: {statements:[...]}")
return
}
ctx := client.WithInternalAuth(r.Context())
if err := g.client.Database().Transaction(ctx, body.Statements); err != nil {
writeError(w, http.StatusInternalServerError, err.Error());
writeError(w, http.StatusInternalServerError, err.Error())
return
}
writeJSON(w, http.StatusOK, map[string]any{"status":"ok"})
writeJSON(w, http.StatusOK, map[string]any{"status": "ok"})
}
func (g *Gateway) dbSchemaHandler(w http.ResponseWriter, r *http.Request) {
if g.client == nil {
writeError(w, http.StatusServiceUnavailable, "client not initialized");
writeError(w, http.StatusServiceUnavailable, "client not initialized")
return
}
if r.Method != http.MethodGet {
writeError(w, http.StatusMethodNotAllowed, "method not allowed");
writeError(w, http.StatusMethodNotAllowed, "method not allowed")
return
}
ctx := client.WithInternalAuth(r.Context())
schema, err := g.client.Database().GetSchema(ctx)
if err != nil {
writeError(w, http.StatusInternalServerError, err.Error());
writeError(w, http.StatusInternalServerError, err.Error())
return
}
writeJSON(w, http.StatusOK, schema)
@ -74,46 +79,50 @@ func (g *Gateway) dbSchemaHandler(w http.ResponseWriter, r *http.Request) {
func (g *Gateway) dbCreateTableHandler(w http.ResponseWriter, r *http.Request) {
if g.client == nil {
writeError(w, http.StatusServiceUnavailable, "client not initialized");
writeError(w, http.StatusServiceUnavailable, "client not initialized")
return
}
if r.Method != http.MethodPost {
writeError(w, http.StatusMethodNotAllowed, "method not allowed");
writeError(w, http.StatusMethodNotAllowed, "method not allowed")
return
}
var body struct{ Schema string `json:"schema"` }
var body struct {
Schema string `json:"schema"`
}
if err := json.NewDecoder(r.Body).Decode(&body); err != nil || body.Schema == "" {
writeError(w, http.StatusBadRequest, "invalid body: {schema}");
writeError(w, http.StatusBadRequest, "invalid body: {schema}")
return
}
ctx := client.WithInternalAuth(r.Context())
if err := g.client.Database().CreateTable(ctx, body.Schema); err != nil {
writeError(w, http.StatusInternalServerError, err.Error());
writeError(w, http.StatusInternalServerError, err.Error())
return
}
writeJSON(w, http.StatusCreated, map[string]any{"status":"ok"})
writeJSON(w, http.StatusCreated, map[string]any{"status": "ok"})
}
func (g *Gateway) dbDropTableHandler(w http.ResponseWriter, r *http.Request) {
if g.client == nil {
writeError(w, http.StatusServiceUnavailable, "client not initialized");
writeError(w, http.StatusServiceUnavailable, "client not initialized")
return
}
if r.Method != http.MethodPost {
writeError(w, http.StatusMethodNotAllowed, "method not allowed");
writeError(w, http.StatusMethodNotAllowed, "method not allowed")
return
}
var body struct{ Table string `json:"table"` }
var body struct {
Table string `json:"table"`
}
if err := json.NewDecoder(r.Body).Decode(&body); err != nil || body.Table == "" {
writeError(w, http.StatusBadRequest, "invalid body: {table}");
writeError(w, http.StatusBadRequest, "invalid body: {table}")
return
}
ctx := client.WithInternalAuth(r.Context())
if err := g.client.Database().DropTable(ctx, body.Table); err != nil {
writeError(w, http.StatusInternalServerError, err.Error());
writeError(w, http.StatusInternalServerError, err.Error())
return
}
writeJSON(w, http.StatusOK, map[string]any{"status":"ok"})
writeJSON(w, http.StatusOK, map[string]any{"status": "ok"})
}
func (g *Gateway) networkStatusHandler(w http.ResponseWriter, r *http.Request) {

View File

@ -22,11 +22,11 @@ import (
"github.com/multiformats/go-multiaddr"
"go.uber.org/zap"
"git.debros.io/DeBros/network/pkg/anyoneproxy"
"git.debros.io/DeBros/network/pkg/config"
"git.debros.io/DeBros/network/pkg/database"
"git.debros.io/DeBros/network/pkg/logging"
"git.debros.io/DeBros/network/pkg/pubsub"
"github.com/DeBrosOfficial/network/pkg/anyoneproxy"
"github.com/DeBrosOfficial/network/pkg/config"
"github.com/DeBrosOfficial/network/pkg/database"
"github.com/DeBrosOfficial/network/pkg/logging"
"github.com/DeBrosOfficial/network/pkg/pubsub"
)
// Node represents a network node with RQLite database

View File

@ -9,7 +9,7 @@ import (
"testing"
"time"
"git.debros.io/DeBros/network/pkg/config"
"github.com/DeBrosOfficial/network/pkg/config"
"github.com/libp2p/go-libp2p"
"github.com/libp2p/go-libp2p/core/crypto"
"github.com/libp2p/go-libp2p/core/network"

View File

@ -17,7 +17,7 @@ NOCOLOR='\033[0m'
# Defaults
INSTALL_DIR="/opt/debros"
REPO_URL="https://git.debros.io/DeBros/network.git"
REPO_URL="https://github.com/DeBrosOfficial/network.git"
MIN_GO_VERSION="1.21"
NODE_PORT="4001"
RQLITE_PORT="5001"