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

@@ -1,9 +1,9 @@
package requestmodifers
import (
"strings"
//"fmt"
"ladder/proxychain"
"strings"
)
var forwardBlacklist map[string]bool
@@ -27,7 +27,6 @@ func init() {
// ForwardRequestHeaders forwards the requests headers sent from the client to the upstream server
func ForwardRequestHeaders() proxychain.RequestModification {
return func(chain *proxychain.ProxyChain) error {
forwardHeaders := func(key, value []byte) {
k := strings.ToLower(string(key))
v := string(value)

View File

@@ -3,10 +3,10 @@ package requestmodifers
import (
"fmt"
"net/url"
"regexp"
"ladder/proxychain"
tx "ladder/proxychain/responsemodifers"
"regexp"
)
const archivistUrl string = "https://archive.is/latest"

View File

@@ -2,10 +2,10 @@ package requestmodifers
import (
"net/url"
"regexp"
"ladder/proxychain"
tx "ladder/proxychain/responsemodifers"
"regexp"
)
const waybackUrl string = "https://web.archive.org/web/"

View File

@@ -4,15 +4,16 @@ import (
"context"
"encoding/json"
"fmt"
http "github.com/bogdanfinn/fhttp"
"net"
"time"
http "github.com/bogdanfinn/fhttp"
/*
tls_client "github.com/bogdanfinn/tls-client"
//"net/http"
*/
"time"
"ladder/proxychain"
)
@@ -71,7 +72,6 @@ func (cd *CustomDialer) DialContext(ctx context.Context, network, addr string) (
// ResolveWithGoogleDoH modifies a ProxyChain's client to make the request by resolving the URL
// using Google's DNS over HTTPs service
func ResolveWithGoogleDoH() proxychain.RequestModification {
///customDialer := NewCustomDialer(10*time.Second, 10*time.Second)
return func(chain *proxychain.ProxyChain) error {
/*

View File

@@ -2,6 +2,7 @@ package requestmodifers
import (
"fmt"
"ladder/proxychain"
tx "ladder/proxychain/responsemodifers"
)
@@ -12,7 +13,6 @@ import (
// if url is "", then the referrer header is removed.
func SpoofReferrer(url string) proxychain.RequestModification {
return func(chain *proxychain.ProxyChain) error {
// change refer on client side js
script := fmt.Sprintf(`document.referrer = "%s"`, url)
chain.AddOnceResponseModifications(

View File

@@ -2,9 +2,10 @@ package requestmodifers
import (
_ "embed"
"strings"
"ladder/proxychain"
tx "ladder/proxychain/responsemodifers"
"strings"
)
// https://github.com/faisalman/ua-parser-js/tree/master

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
}