初始化

This commit is contained in:
Administrator
2024-09-04 16:48:42 +08:00
parent 229b8ca83a
commit 688c516c9f
26 changed files with 126 additions and 1936 deletions

View File

@ -1,8 +1,8 @@
package middleware
import (
"github.com/geziyor/geziyor/client"
"github.com/geziyor/geziyor/internal"
"softdown.com/shusou/geziyor/client"
"softdown.com/shusou/geziyor/internal"
"sync"
)

View File

@ -1,8 +1,8 @@
package middleware
import (
"github.com/geziyor/geziyor/client"
"math/rand"
"softdown.com/shusou/geziyor/client"
"time"
)

View File

@ -1,8 +1,8 @@
package middleware
import (
"github.com/geziyor/geziyor/client"
"github.com/geziyor/geziyor/internal"
"softdown.com/shusou/geziyor/client"
"softdown.com/shusou/geziyor/internal"
"sync"
)

View File

@ -1,8 +1,8 @@
package middleware
import (
"github.com/geziyor/geziyor/client"
"github.com/stretchr/testify/assert"
"softdown.com/shusou/geziyor/client"
"strings"
"testing"
)

View File

@ -1,7 +1,7 @@
package middleware
import (
"github.com/geziyor/geziyor/client"
"softdown.com/shusou/geziyor/client"
)
// Headers sets default request headers

View File

@ -1,8 +1,8 @@
package middleware
import (
"github.com/geziyor/geziyor/client"
"github.com/geziyor/geziyor/internal"
"softdown.com/shusou/geziyor/client"
"softdown.com/shusou/geziyor/internal"
)
// LogStats logs responses

View File

@ -1,8 +1,8 @@
package middleware
import (
"github.com/geziyor/geziyor/client"
"github.com/geziyor/geziyor/metrics"
"softdown.com/shusou/geziyor/client"
"softdown.com/shusou/geziyor/metrics"
"strconv"
)

View File

@ -1,7 +1,7 @@
package middleware
import (
"github.com/geziyor/geziyor/client"
"softdown.com/shusou/geziyor/client"
)
// RequestResponseProcessor interface is for middlewares that needs to process both requests and responses

View File

@ -3,8 +3,8 @@ package middleware
import (
"bytes"
"github.com/PuerkitoBio/goquery"
"github.com/geziyor/geziyor/client"
"github.com/geziyor/geziyor/internal"
"softdown.com/shusou/geziyor/client"
"softdown.com/shusou/geziyor/internal"
)
// ParseHTML parses response if response is HTML

View File

@ -1,10 +1,11 @@
package middleware
import (
"github.com/geziyor/geziyor/client"
"github.com/geziyor/geziyor/internal"
"github.com/geziyor/geziyor/metrics"
"github.com/temoto/robotstxt"
"net/http"
"softdown.com/shusou/geziyor/client"
"softdown.com/shusou/geziyor/internal"
"softdown.com/shusou/geziyor/metrics"
"strconv"
"sync"
)
@ -38,7 +39,7 @@ func (m *RobotsTxt) ProcessRequest(r *client.Request) {
m.mut.RUnlock()
if !exists {
robotsReq, err := client.NewRequest("GET", r.URL.Scheme+"://"+r.Host+"/robots.txt", nil)
robotsReq, err := client.NewRequest(http.MethodGet, r.URL.Scheme+"://"+r.Host+"/robots.txt", "", nil)
if err != nil {
return // Don't Do anything
}