rename major package folers web->app, relay->server

This commit is contained in:
0ceanSlim 2024-07-31 14:12:33 -04:00
parent f291c07bfa
commit 5eb6fd961e
37 changed files with 38 additions and 38 deletions

View File

@ -1,4 +1,4 @@
package web
package app
import (
"context"

View File

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

View File

@ -1,4 +1,4 @@
package web
package app
import (
"encoding/json"
@ -19,7 +19,7 @@ type RelayMetadata struct {
var relayMetadata RelayMetadata
func LoadRelayMetadataJSON() error {
return LoadRelayMetadata("relay_metadata.json")
return LoadRelayMetadata("app/relay_metadata.json")
}
func LoadRelayMetadata(filename string) error {

View File

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

16
main.go
View File

@ -2,12 +2,12 @@ package main
import (
"fmt"
"grain/app"
"grain/config"
configTypes "grain/config/types"
"grain/relay"
"grain/relay/db"
"grain/relay/utils"
"grain/web"
relay "grain/server"
"grain/server/db"
"grain/server/utils"
"log"
"net/http"
@ -17,7 +17,7 @@ import (
func main() {
utils.EnsureFileExists("config.yml", "config/config.example.yml")
utils.EnsureFileExists("relay_metadata.json", "web/relay_metadata.example.json")
utils.EnsureFileExists("app/relay_metadata.json", "app/relay_metadata.example.json")
cfg, err := config.LoadConfig("config.yml")
if err != nil {
@ -33,7 +33,7 @@ func main() {
config.SetupRateLimiter(cfg)
config.SetupSizeLimiter(cfg)
err = web.LoadRelayMetadataJSON()
err = app.LoadRelayMetadataJSON()
if err != nil {
log.Fatal("Failed to load relay metadata: ", err)
}
@ -67,8 +67,8 @@ func ListenAndServe(w http.ResponseWriter, r *http.Request) {
relay.WebSocketHandler(ws)
}).ServeHTTP(w, r)
} else if r.Header.Get("Accept") == "application/nostr+json" {
web.RelayInfoHandler(w, r)
app.RelayInfoHandler(w, r)
} else {
web.RootHandler(w, r)
app.RootHandler(w, r)
}
}

View File

@ -5,12 +5,12 @@ import (
"encoding/json"
"fmt"
"grain/config"
"grain/relay/db"
"grain/relay/handlers/kinds"
"grain/relay/handlers/response"
"grain/relay/utils"
"grain/server/db"
"grain/server/handlers/kinds"
"grain/server/handlers/response"
"grain/server/utils"
relay "grain/relay/types"
relay "grain/server/types"
"golang.org/x/net/websocket"
)

View File

@ -3,8 +3,8 @@ package kinds
import (
"context"
"fmt"
"grain/relay/handlers/response"
relay "grain/relay/types"
"grain/server/handlers/response"
relay "grain/server/types"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"

View File

@ -4,8 +4,8 @@ package kinds
import (
"context"
"fmt"
"grain/relay/handlers/response"
relay "grain/relay/types"
"grain/server/handlers/response"
relay "grain/server/types"
"go.mongodb.org/mongo-driver/mongo"
"golang.org/x/net/websocket"

View File

@ -2,8 +2,8 @@ package kinds
import (
"context"
"grain/relay/handlers/response"
relay "grain/relay/types"
"grain/server/handlers/response"
relay "grain/server/types"
"golang.org/x/net/websocket"
)

View File

@ -3,8 +3,8 @@ package kinds
import (
"context"
"fmt"
"grain/relay/handlers/response"
relay "grain/relay/types"
"grain/server/handlers/response"
relay "grain/server/types"
"strings"
"go.mongodb.org/mongo-driver/bson"

View File

@ -3,8 +3,8 @@ package kinds
import (
"context"
"fmt"
"grain/relay/handlers/response"
relay "grain/relay/types"
"grain/server/handlers/response"
relay "grain/server/types"
"go.mongodb.org/mongo-driver/mongo"
"golang.org/x/net/websocket"

View File

@ -3,8 +3,8 @@ package kinds
import (
"context"
"fmt"
"grain/relay/handlers/response"
relay "grain/relay/types"
"grain/server/handlers/response"
relay "grain/server/types"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"

View File

@ -3,8 +3,8 @@ package kinds
import (
"context"
"fmt"
"grain/relay/handlers/response"
relay "grain/relay/types"
"grain/server/handlers/response"
relay "grain/server/types"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"

View File

@ -2,8 +2,8 @@ package kinds
import (
"context"
"grain/relay/handlers/response"
relay "grain/relay/types"
"grain/server/handlers/response"
relay "grain/server/types"
"go.mongodb.org/mongo-driver/mongo"
"golang.org/x/net/websocket"

View File

@ -4,10 +4,10 @@ import (
"context"
"encoding/json"
"fmt"
"grain/relay/db"
"grain/relay/handlers/response"
relay "grain/relay/types"
"grain/relay/utils"
"grain/server/db"
"grain/server/handlers/response"
relay "grain/server/types"
"grain/server/utils"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"

View File

@ -3,7 +3,7 @@ package relay
import (
"encoding/json"
"fmt"
"grain/relay/handlers"
"grain/server/handlers"
"grain/config"

View File

@ -6,7 +6,7 @@ import (
"encoding/json"
"log"
relay "grain/relay/types"
relay "grain/server/types"
"github.com/btcsuite/btcd/btcec/v2"
"github.com/btcsuite/btcd/btcec/v2/schnorr"