xmr-remote-nodes/internal/handler/server.go
Christian Ditaputratama 48a25bece0
feat: Store hashed user IP address when submitting new node
This feature added to help trace spammers. The IP address stored with
one-way hash + salt to maintain user privacy.
2024-11-25 04:51:51 +07:00

32 lines
700 B
Go

package handler
import (
"github.com/ditatompel/xmr-remote-nodes/internal/config"
"github.com/ditatompel/xmr-remote-nodes/internal/database"
"github.com/gofiber/fiber/v2"
)
type fiberServer struct {
*fiber.App
db *database.DB
url string
secret string
}
// NewServer returns a new fiber server
func NewServer() *fiberServer {
if database.ConnectDB() != nil {
panic("Failed to connect to database")
}
server := &fiberServer{
App: fiber.New(fiber.Config{
Prefork: config.AppCfg().Prefork,
ProxyHeader: config.AppCfg().ProxyHeader,
AppName: "XMR Nodes Aggregator " + config.Version,
}),
db: database.GetDB(),
url: config.AppCfg().URL,
}
return server
}