mirror of
https://github.com/0ceanSlim/grain.git
synced 2024-11-24 01:17:13 +00:00
rename major package folers web->app, relay->server
This commit is contained in:
parent
f291c07bfa
commit
5eb6fd961e
@ -1,4 +1,4 @@
|
|||||||
package web
|
package app
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 66 KiB |
@ -1,4 +1,4 @@
|
|||||||
package web
|
package app
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
@ -19,7 +19,7 @@ type RelayMetadata struct {
|
|||||||
var relayMetadata RelayMetadata
|
var relayMetadata RelayMetadata
|
||||||
|
|
||||||
func LoadRelayMetadataJSON() error {
|
func LoadRelayMetadataJSON() error {
|
||||||
return LoadRelayMetadata("relay_metadata.json")
|
return LoadRelayMetadata("app/relay_metadata.json")
|
||||||
}
|
}
|
||||||
|
|
||||||
func LoadRelayMetadata(filename string) error {
|
func LoadRelayMetadata(filename string) error {
|
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 66 KiB |
16
main.go
16
main.go
@ -2,12 +2,12 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"grain/app"
|
||||||
"grain/config"
|
"grain/config"
|
||||||
configTypes "grain/config/types"
|
configTypes "grain/config/types"
|
||||||
"grain/relay"
|
relay "grain/server"
|
||||||
"grain/relay/db"
|
"grain/server/db"
|
||||||
"grain/relay/utils"
|
"grain/server/utils"
|
||||||
"grain/web"
|
|
||||||
|
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
@ -17,7 +17,7 @@ import (
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
utils.EnsureFileExists("config.yml", "config/config.example.yml")
|
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")
|
cfg, err := config.LoadConfig("config.yml")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -33,7 +33,7 @@ func main() {
|
|||||||
config.SetupRateLimiter(cfg)
|
config.SetupRateLimiter(cfg)
|
||||||
config.SetupSizeLimiter(cfg)
|
config.SetupSizeLimiter(cfg)
|
||||||
|
|
||||||
err = web.LoadRelayMetadataJSON()
|
err = app.LoadRelayMetadataJSON()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("Failed to load relay metadata: ", err)
|
log.Fatal("Failed to load relay metadata: ", err)
|
||||||
}
|
}
|
||||||
@ -67,8 +67,8 @@ func ListenAndServe(w http.ResponseWriter, r *http.Request) {
|
|||||||
relay.WebSocketHandler(ws)
|
relay.WebSocketHandler(ws)
|
||||||
}).ServeHTTP(w, r)
|
}).ServeHTTP(w, r)
|
||||||
} else if r.Header.Get("Accept") == "application/nostr+json" {
|
} else if r.Header.Get("Accept") == "application/nostr+json" {
|
||||||
web.RelayInfoHandler(w, r)
|
app.RelayInfoHandler(w, r)
|
||||||
} else {
|
} else {
|
||||||
web.RootHandler(w, r)
|
app.RootHandler(w, r)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,12 +5,12 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"grain/config"
|
"grain/config"
|
||||||
"grain/relay/db"
|
"grain/server/db"
|
||||||
"grain/relay/handlers/kinds"
|
"grain/server/handlers/kinds"
|
||||||
"grain/relay/handlers/response"
|
"grain/server/handlers/response"
|
||||||
"grain/relay/utils"
|
"grain/server/utils"
|
||||||
|
|
||||||
relay "grain/relay/types"
|
relay "grain/server/types"
|
||||||
|
|
||||||
"golang.org/x/net/websocket"
|
"golang.org/x/net/websocket"
|
||||||
)
|
)
|
@ -3,8 +3,8 @@ package kinds
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"grain/relay/handlers/response"
|
"grain/server/handlers/response"
|
||||||
relay "grain/relay/types"
|
relay "grain/server/types"
|
||||||
|
|
||||||
"go.mongodb.org/mongo-driver/bson"
|
"go.mongodb.org/mongo-driver/bson"
|
||||||
"go.mongodb.org/mongo-driver/mongo"
|
"go.mongodb.org/mongo-driver/mongo"
|
@ -4,8 +4,8 @@ package kinds
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"grain/relay/handlers/response"
|
"grain/server/handlers/response"
|
||||||
relay "grain/relay/types"
|
relay "grain/server/types"
|
||||||
|
|
||||||
"go.mongodb.org/mongo-driver/mongo"
|
"go.mongodb.org/mongo-driver/mongo"
|
||||||
"golang.org/x/net/websocket"
|
"golang.org/x/net/websocket"
|
@ -2,8 +2,8 @@ package kinds
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"grain/relay/handlers/response"
|
"grain/server/handlers/response"
|
||||||
relay "grain/relay/types"
|
relay "grain/server/types"
|
||||||
|
|
||||||
"golang.org/x/net/websocket"
|
"golang.org/x/net/websocket"
|
||||||
)
|
)
|
@ -3,8 +3,8 @@ package kinds
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"grain/relay/handlers/response"
|
"grain/server/handlers/response"
|
||||||
relay "grain/relay/types"
|
relay "grain/server/types"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"go.mongodb.org/mongo-driver/bson"
|
"go.mongodb.org/mongo-driver/bson"
|
@ -3,8 +3,8 @@ package kinds
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"grain/relay/handlers/response"
|
"grain/server/handlers/response"
|
||||||
relay "grain/relay/types"
|
relay "grain/server/types"
|
||||||
|
|
||||||
"go.mongodb.org/mongo-driver/mongo"
|
"go.mongodb.org/mongo-driver/mongo"
|
||||||
"golang.org/x/net/websocket"
|
"golang.org/x/net/websocket"
|
@ -3,8 +3,8 @@ package kinds
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"grain/relay/handlers/response"
|
"grain/server/handlers/response"
|
||||||
relay "grain/relay/types"
|
relay "grain/server/types"
|
||||||
|
|
||||||
"go.mongodb.org/mongo-driver/bson"
|
"go.mongodb.org/mongo-driver/bson"
|
||||||
"go.mongodb.org/mongo-driver/mongo"
|
"go.mongodb.org/mongo-driver/mongo"
|
@ -3,8 +3,8 @@ package kinds
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"grain/relay/handlers/response"
|
"grain/server/handlers/response"
|
||||||
relay "grain/relay/types"
|
relay "grain/server/types"
|
||||||
|
|
||||||
"go.mongodb.org/mongo-driver/bson"
|
"go.mongodb.org/mongo-driver/bson"
|
||||||
"go.mongodb.org/mongo-driver/mongo"
|
"go.mongodb.org/mongo-driver/mongo"
|
@ -2,8 +2,8 @@ package kinds
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"grain/relay/handlers/response"
|
"grain/server/handlers/response"
|
||||||
relay "grain/relay/types"
|
relay "grain/server/types"
|
||||||
|
|
||||||
"go.mongodb.org/mongo-driver/mongo"
|
"go.mongodb.org/mongo-driver/mongo"
|
||||||
"golang.org/x/net/websocket"
|
"golang.org/x/net/websocket"
|
@ -4,10 +4,10 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"grain/relay/db"
|
"grain/server/db"
|
||||||
"grain/relay/handlers/response"
|
"grain/server/handlers/response"
|
||||||
relay "grain/relay/types"
|
relay "grain/server/types"
|
||||||
"grain/relay/utils"
|
"grain/server/utils"
|
||||||
|
|
||||||
"go.mongodb.org/mongo-driver/bson"
|
"go.mongodb.org/mongo-driver/bson"
|
||||||
"go.mongodb.org/mongo-driver/mongo"
|
"go.mongodb.org/mongo-driver/mongo"
|
@ -3,7 +3,7 @@ package relay
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"grain/relay/handlers"
|
"grain/server/handlers"
|
||||||
|
|
||||||
"grain/config"
|
"grain/config"
|
||||||
|
|
@ -6,7 +6,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
relay "grain/relay/types"
|
relay "grain/server/types"
|
||||||
|
|
||||||
"github.com/btcsuite/btcd/btcec/v2"
|
"github.com/btcsuite/btcd/btcec/v2"
|
||||||
"github.com/btcsuite/btcd/btcec/v2/schnorr"
|
"github.com/btcsuite/btcd/btcec/v2/schnorr"
|
Loading…
Reference in New Issue
Block a user