fix import orders

This commit is contained in:
Damian Bednarczyk
2023-11-29 15:02:05 -06:00
parent 3fdbf3524d
commit dc558b38fa
9 changed files with 19 additions and 14 deletions

View File

@@ -2,9 +2,10 @@ package responsemodifers
import (
"fmt"
"ladder/proxychain"
"net/url"
"strings"
"ladder/proxychain"
)
var forwardBlacklist map[string]bool
@@ -23,7 +24,6 @@ func init() {
// ForwardResponseHeaders forwards the response headers from the upstream server to the client
func ForwardResponseHeaders() proxychain.ResponseModification {
return func(chain *proxychain.ProxyChain) error {
//fmt.Println(chain.Response.Header)
for uname, headers := range chain.Response.Header {
name := strings.ToLower(uname)

View File

@@ -3,10 +3,12 @@ package responsemodifers
import (
"bytes"
"encoding/json"
"io"
//"github.com/go-shiori/dom"
"github.com/markusmobius/go-trafilatura"
//"golang.org/x/net/html"
"io"
"ladder/proxychain"
"ladder/proxychain/responsemodifers/api"
)
@@ -46,5 +48,4 @@ func APIOutline() proxychain.ResponseModification {
chain.Response.Body = io.NopCloser(buf)
return nil
}
}

View File

@@ -66,6 +66,7 @@ func (r *HTMLRewriter) Close() error {
r.tokenBuffer.Reset()
r.currentToken = nil
r.currentTokenProcessed = false
return nil
}
@@ -79,6 +80,7 @@ func (r *HTMLRewriter) Read(p []byte) (int, error) {
if r.tokenizer.Err() == io.EOF {
return 0, io.EOF
}
return 0, r.tokenizer.Err()
}
@@ -96,6 +98,7 @@ func (r *HTMLRewriter) Read(p []byte) (int, error) {
if !rewriter.ShouldModify(r.currentToken) {
continue
}
prepend, a := rewriter.ModifyToken(r.currentToken)
appends = append(appends, a)
// add <prepends> to buffer
@@ -125,5 +128,6 @@ func (r *HTMLRewriter) Read(p []byte) (int, error) {
r.currentTokenProcessed = true
err = nil // EOF in this context is expected and not an actual error
}
return n, err
}