mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-09-28 05:46:36 +08:00
[优化] 目录调整
This commit is contained in:
@@ -21,12 +21,13 @@ COPY go.mod go.sum ./
|
||||
RUN --mount=type=cache,target=/go/pkg/mod \
|
||||
go mod download
|
||||
COPY openflare-server ./openflare-server
|
||||
COPY pkg ./pkg
|
||||
COPY --from=web-builder /build/build ./openflare-server/web/build
|
||||
RUN --mount=type=cache,target=/go/pkg/mod \
|
||||
--mount=type=cache,target=/root/.cache/go-build \
|
||||
go build -trimpath \
|
||||
-ldflags "-s -w -X 'github.com/rain-kl/openflare/openflare-server/common.Version=$VERSION'" \
|
||||
-o openflare ./openflare-server
|
||||
-ldflags "-s -w -X 'github.com/rain-kl/openflare/openflare-server/internal/common.Version=$VERSION'" \
|
||||
-o openflare ./openflare-server/cmd/server
|
||||
|
||||
FROM alpine:latest
|
||||
RUN apk add --no-cache ca-certificates tzdata \
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package main
|
||||
|
||||
import server "github.com/rain-kl/openflare/openflare-server"
|
||||
|
||||
func main() {
|
||||
server.Run()
|
||||
}
|
||||
+3
-3
@@ -3,9 +3,9 @@ package controller
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/rain-kl/openflare/openflare-server/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/controller/bind"
|
||||
"github.com/rain-kl/openflare/openflare-server/service"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/controller/bind"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/service"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"github.com/rain-kl/openflare/openflare-server/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/model"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/model"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
+5
-5
@@ -7,11 +7,11 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/rain-kl/openflare/openflare-server/common"
|
||||
"github.com/rain-kl/openflare/openflare-server/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/controller/bind"
|
||||
"github.com/rain-kl/openflare/openflare-server/model"
|
||||
"github.com/rain-kl/openflare/openflare-server/service"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/controller/bind"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/model"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/service"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"golang.org/x/net/websocket"
|
||||
+5
-5
@@ -7,11 +7,11 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/rain-kl/openflare/openflare-server/common"
|
||||
"github.com/rain-kl/openflare/openflare-server/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/controller/bind"
|
||||
"github.com/rain-kl/openflare/openflare-server/model"
|
||||
"github.com/rain-kl/openflare/openflare-server/service"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/controller/bind"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/model"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/service"
|
||||
|
||||
"github.com/gin-contrib/sessions"
|
||||
"github.com/gin-gonic/gin"
|
||||
+1
-1
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"github.com/rain-kl/openflare/openflare-server/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
|
||||
)
|
||||
|
||||
// DecodeJSONBody decodes JSON reader to target
|
||||
@@ -4,9 +4,9 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/rain-kl/openflare/openflare-server/controller/bind"
|
||||
"github.com/rain-kl/openflare/openflare-server/service"
|
||||
"github.com/rain-kl/openflare/openflare-server/utils/cap"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/controller/bind"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/service"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/utils/cap"
|
||||
)
|
||||
|
||||
// GetCapChallenge generates a new CAPTCHA challenge
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"github.com/rain-kl/openflare/openflare-server/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/controller/bind"
|
||||
"github.com/rain-kl/openflare/openflare-server/service"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/controller/bind"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/service"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"github.com/rain-kl/openflare/openflare-server/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/service"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/service"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"github.com/rain-kl/openflare/openflare-server/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/controller/bind"
|
||||
"github.com/rain-kl/openflare/openflare-server/service"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/controller/bind"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/service"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"github.com/rain-kl/openflare/openflare-server/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/controller/bind"
|
||||
"github.com/rain-kl/openflare/openflare-server/model"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/controller/bind"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/model"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
+5
-5
@@ -5,11 +5,11 @@ import (
|
||||
"net"
|
||||
"time"
|
||||
|
||||
"github.com/rain-kl/openflare/openflare-server/common"
|
||||
"github.com/rain-kl/openflare/openflare-server/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/controller/bind"
|
||||
"github.com/rain-kl/openflare/openflare-server/model"
|
||||
"github.com/rain-kl/openflare/openflare-server/service"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/controller/bind"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/model"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/service"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"golang.org/x/net/websocket"
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"github.com/rain-kl/openflare/openflare-server/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/controller/bind"
|
||||
"github.com/rain-kl/openflare/openflare-server/service"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/controller/bind"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/service"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
+3
-3
@@ -9,9 +9,9 @@ import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/rain-kl/openflare/openflare-server/common"
|
||||
"github.com/rain-kl/openflare/openflare-server/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/model"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/model"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
+3
-3
@@ -3,9 +3,9 @@ package controller
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/rain-kl/openflare/openflare-server/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/controller/bind"
|
||||
"github.com/rain-kl/openflare/openflare-server/service"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/controller/bind"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/service"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
@@ -3,14 +3,14 @@ package controller
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/rain-kl/openflare/openflare-server/common"
|
||||
"github.com/rain-kl/openflare/openflare-server/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/controller/bind"
|
||||
"github.com/rain-kl/openflare/openflare-server/model"
|
||||
"github.com/rain-kl/openflare/openflare-server/service"
|
||||
"github.com/rain-kl/openflare/openflare-server/utils/mail"
|
||||
"github.com/rain-kl/openflare/openflare-server/utils/security"
|
||||
"github.com/rain-kl/openflare/openflare-server/utils/validation"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/controller/bind"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/model"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/service"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/utils/mail"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/utils/security"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/utils/validation"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
@@ -1,9 +1,9 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"github.com/rain-kl/openflare/openflare-server/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/controller/bind"
|
||||
"github.com/rain-kl/openflare/openflare-server/service"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/controller/bind"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/service"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
+7
-7
@@ -6,13 +6,13 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/rain-kl/openflare/openflare-server/common"
|
||||
"github.com/rain-kl/openflare/openflare-server/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/controller/bind"
|
||||
"github.com/rain-kl/openflare/openflare-server/model"
|
||||
"github.com/rain-kl/openflare/openflare-server/service"
|
||||
"github.com/rain-kl/openflare/openflare-server/utils"
|
||||
"github.com/rain-kl/openflare/openflare-server/utils/geoip"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/controller/bind"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/model"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/service"
|
||||
"github.com/rain-kl/openflare/pkg/geoip"
|
||||
"github.com/rain-kl/openflare/pkg/utils"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"github.com/rain-kl/openflare/openflare-server/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/controller/bind"
|
||||
"github.com/rain-kl/openflare/openflare-server/service"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/controller/bind"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/service"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"github.com/rain-kl/openflare/openflare-server/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/controller/bind"
|
||||
"github.com/rain-kl/openflare/openflare-server/service"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/controller/bind"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/service"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"github.com/rain-kl/openflare/openflare-server/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/controller/bind"
|
||||
"github.com/rain-kl/openflare/openflare-server/service"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/controller/bind"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/service"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
+4
-4
@@ -5,10 +5,10 @@ import (
|
||||
"net"
|
||||
"time"
|
||||
|
||||
"github.com/rain-kl/openflare/openflare-server/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/controller/bind"
|
||||
"github.com/rain-kl/openflare/openflare-server/model"
|
||||
"github.com/rain-kl/openflare/openflare-server/service"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/controller/bind"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/model"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/service"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"golang.org/x/net/websocket"
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"github.com/rain-kl/openflare/openflare-server/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/controller/bind"
|
||||
"github.com/rain-kl/openflare/openflare-server/service"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/controller/bind"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/service"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
+3
-3
@@ -3,9 +3,9 @@ package controller
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/rain-kl/openflare/openflare-server/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/controller/bind"
|
||||
"github.com/rain-kl/openflare/openflare-server/service"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/controller/bind"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/service"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"golang.org/x/net/websocket"
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"github.com/rain-kl/openflare/openflare-server/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/service"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/service"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
@@ -3,13 +3,13 @@ package controller
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/rain-kl/openflare/openflare-server/common"
|
||||
"github.com/rain-kl/openflare/openflare-server/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/controller/bind"
|
||||
"github.com/rain-kl/openflare/openflare-server/middleware"
|
||||
"github.com/rain-kl/openflare/openflare-server/model"
|
||||
"github.com/rain-kl/openflare/openflare-server/utils/security"
|
||||
"github.com/rain-kl/openflare/openflare-server/utils/validation"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/controller/bind"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/middleware"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/model"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/utils/security"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/utils/validation"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
@@ -3,9 +3,9 @@ package controller
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/rain-kl/openflare/openflare-server/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/controller/bind"
|
||||
"github.com/rain-kl/openflare/openflare-server/service"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/controller/bind"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/service"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
+3
-3
@@ -9,9 +9,9 @@ import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/rain-kl/openflare/openflare-server/common"
|
||||
"github.com/rain-kl/openflare/openflare-server/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/model"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/model"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"log/slog"
|
||||
"time"
|
||||
|
||||
"github.com/rain-kl/openflare/openflare-server/model"
|
||||
"github.com/rain-kl/openflare/openflare-server/service"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/model"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/service"
|
||||
)
|
||||
|
||||
type SSLRenewJob struct {
|
||||
@@ -5,8 +5,8 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/rain-kl/openflare/openflare-server/common"
|
||||
"github.com/rain-kl/openflare/openflare-server/service"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/service"
|
||||
)
|
||||
|
||||
var lastUptimeKumaSyncTime time.Time
|
||||
+1
-1
@@ -3,7 +3,7 @@ package job
|
||||
import (
|
||||
"log/slog"
|
||||
|
||||
"github.com/rain-kl/openflare/openflare-server/service"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/service"
|
||||
)
|
||||
|
||||
type WAFIPGroupSyncJob struct{}
|
||||
+2
-2
@@ -2,8 +2,8 @@ package middleware
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/rain-kl/openflare/openflare-server/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/service"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/service"
|
||||
)
|
||||
|
||||
func AgentAuth() func(c *gin.Context) {
|
||||
@@ -1,9 +1,9 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"github.com/rain-kl/openflare/openflare-server/common"
|
||||
"github.com/rain-kl/openflare/openflare-server/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/model"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/model"
|
||||
|
||||
jwt "github.com/appleboy/gin-jwt/v2"
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -2,8 +2,8 @@ package middleware
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/rain-kl/openflare/openflare-server/common"
|
||||
"github.com/rain-kl/openflare/openflare-server/service"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/service"
|
||||
)
|
||||
|
||||
// CapAuth wraps the core Cap middleware with OpenFlare's dynamic CapLoginEnabled configuration switch
|
||||
@@ -3,7 +3,7 @@ package middleware
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/rain-kl/openflare/openflare-server/common"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common"
|
||||
|
||||
"github.com/gin-contrib/cors"
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -4,9 +4,9 @@ import (
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/rain-kl/openflare/openflare-server/common"
|
||||
"github.com/rain-kl/openflare/openflare-server/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/model"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/model"
|
||||
|
||||
jwt "github.com/appleboy/gin-jwt/v2"
|
||||
"github.com/gin-gonic/gin"
|
||||
+2
-2
@@ -6,8 +6,8 @@ import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/rain-kl/openflare/openflare-server/common"
|
||||
"github.com/rain-kl/openflare/openflare-server/utils/ratelimit"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/utils/ratelimit"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
+2
-2
@@ -2,8 +2,8 @@ package middleware
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/rain-kl/openflare/openflare-server/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/service"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/service"
|
||||
)
|
||||
|
||||
// RelayAuth authenticates Relay requests using the shared agent token,
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"github.com/rain-kl/openflare/openflare-server/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/service"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/service"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
+1
-1
@@ -6,7 +6,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/rain-kl/openflare/openflare-server/utils"
|
||||
"github.com/rain-kl/openflare/pkg/utils"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
+1
-1
@@ -3,7 +3,7 @@ package model
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/rain-kl/openflare/openflare-server/model/migrate"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/model/migrate"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/rain-kl/openflare/openflare-server/common"
|
||||
"github.com/rain-kl/openflare/openflare-server/utils/security"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/utils/security"
|
||||
|
||||
"github.com/glebarez/sqlite"
|
||||
"gorm.io/driver/postgres"
|
||||
+1
-1
@@ -12,7 +12,7 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
schemamigrate "github.com/rain-kl/openflare/openflare-server/model/migrate"
|
||||
schemamigrate "github.com/rain-kl/openflare/openflare-server/internal/model/migrate"
|
||||
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/schema"
|
||||
+1
-1
@@ -3,7 +3,7 @@ package model
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/rain-kl/openflare/openflare-server/utils"
|
||||
"github.com/rain-kl/openflare/pkg/utils"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
+1
-1
@@ -3,7 +3,7 @@ package model
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/rain-kl/openflare/openflare-server/utils"
|
||||
"github.com/rain-kl/openflare/pkg/utils"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
+1
-1
@@ -3,7 +3,7 @@ package model
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/rain-kl/openflare/openflare-server/utils"
|
||||
"github.com/rain-kl/openflare/pkg/utils"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
+1
-1
@@ -3,7 +3,7 @@ package model
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/rain-kl/openflare/openflare-server/utils"
|
||||
"github.com/rain-kl/openflare/pkg/utils"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
+1
-1
@@ -3,7 +3,7 @@ package model
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/rain-kl/openflare/openflare-server/utils"
|
||||
"github.com/rain-kl/openflare/pkg/utils"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
@@ -5,8 +5,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/rain-kl/openflare/openflare-server/common"
|
||||
"github.com/rain-kl/openflare/openflare-server/utils/geoip"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common"
|
||||
"github.com/rain-kl/openflare/pkg/geoip"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
schemagoose "github.com/rain-kl/openflare/openflare-server/model/goose"
|
||||
schemagoose "github.com/rain-kl/openflare/openflare-server/internal/model/goose"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
@@ -3,8 +3,8 @@ package model
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/rain-kl/openflare/openflare-server/common"
|
||||
"github.com/rain-kl/openflare/openflare-server/utils/security"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/utils/security"
|
||||
)
|
||||
|
||||
// User if you add sensitive fields, don't forget to clean them in setupLogin function.
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"github.com/rain-kl/openflare/openflare-server/controller"
|
||||
"github.com/rain-kl/openflare/openflare-server/middleware"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/controller"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/middleware"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
+4
-4
@@ -7,10 +7,10 @@ import (
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/rain-kl/openflare/openflare-server/common"
|
||||
"github.com/rain-kl/openflare/openflare-server/model"
|
||||
"github.com/rain-kl/openflare/openflare-server/router"
|
||||
"github.com/rain-kl/openflare/openflare-server/service"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/model"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/router"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/service"
|
||||
|
||||
"github.com/gin-contrib/sessions"
|
||||
"github.com/gin-contrib/sessions/cookie"
|
||||
+8
-5
@@ -22,11 +22,11 @@ import (
|
||||
"github.com/gin-contrib/sessions"
|
||||
"github.com/gin-contrib/sessions/cookie"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/rain-kl/openflare/openflare-server/common"
|
||||
"github.com/rain-kl/openflare/openflare-server/middleware"
|
||||
"github.com/rain-kl/openflare/openflare-server/model"
|
||||
"github.com/rain-kl/openflare/openflare-server/router"
|
||||
"github.com/rain-kl/openflare/openflare-server/service"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/common"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/middleware"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/model"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/router"
|
||||
"github.com/rain-kl/openflare/openflare-server/internal/service"
|
||||
)
|
||||
|
||||
type apiResponse struct {
|
||||
@@ -484,11 +484,14 @@ func setupTestDB(t *testing.T) {
|
||||
dbPath := filepath.Join(t.TempDir(), "phase1.db")
|
||||
common.SQLitePath = dbPath
|
||||
common.AccessToken = "phase1-agent-token"
|
||||
originalCapLoginEnabled := common.CapLoginEnabled
|
||||
common.CapLoginEnabled = false
|
||||
if err := model.InitDB(); err != nil {
|
||||
t.Fatalf("failed to init db: %v", err)
|
||||
}
|
||||
middleware.InitJWTMiddleware()
|
||||
t.Cleanup(func() {
|
||||
common.CapLoginEnabled = originalCapLoginEnabled
|
||||
if err := model.CloseDB(); err != nil {
|
||||
t.Fatalf("failed to close db: %v", err)
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user