50 lines
967 B
Go
50 lines
967 B
Go
package handlers
|
|
|
|
import (
|
|
"ladder/proxychain"
|
|
rx "ladder/proxychain/requestmodifers"
|
|
tx "ladder/proxychain/responsemodifers"
|
|
|
|
"github.com/gofiber/fiber/v2"
|
|
)
|
|
|
|
type ProxyOptions struct {
|
|
RulesetPath string
|
|
Verbose bool
|
|
}
|
|
|
|
func NewProxySiteHandler(opts *ProxyOptions) fiber.Handler {
|
|
/*
|
|
var rs ruleset.RuleSet
|
|
if opts.RulesetPath != "" {
|
|
r, err := ruleset.NewRuleset(opts.RulesetPath)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
rs = r
|
|
}
|
|
*/
|
|
|
|
return func(c *fiber.Ctx) error {
|
|
proxychain := proxychain.
|
|
NewProxyChain().
|
|
SetFiberCtx(c).
|
|
SetDebugLogging(opts.Verbose).
|
|
SetRequestModifications(
|
|
rx.MasqueradeAsFacebookBot(),
|
|
rx.DeleteOutgoingCookies(),
|
|
// rx.RequestArchiveIs(),
|
|
).
|
|
AddResponseModifications(
|
|
tx.BypassCORS(),
|
|
//tx.BypassContentSecurityPolicy(),
|
|
//tx.DeleteIncomingCookies(),
|
|
//tx.RewriteHTMLResourceURLs(),
|
|
//tx.PatchDynamicResourceURLs(),
|
|
).
|
|
Execute()
|
|
|
|
return proxychain
|
|
}
|
|
}
|