Advertisement
FlyFar

transport.go

Dec 28th, 2023
978
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.39 KB | Cybersecurity | 0 0
  1. package main
  2.  
  3. import (
  4.     "net/http"
  5.     "net/url"
  6.  
  7.     log "github.com/sirupsen/logrus"
  8. )
  9.  
  10. type Transport struct {
  11.     Close func()
  12. }
  13.  
  14. func (t *Transport) Default() *http.Transport {
  15.     return &http.Transport{}
  16. }
  17.  
  18. func (t *Transport) Proxy(addr string) *http.Transport {
  19.     url, err := url.Parse(addr)
  20.  
  21.     if err != nil {
  22.         log.Panic(err)
  23.     }
  24.  
  25.     return &http.Transport{Proxy: http.ProxyURL(url)}
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement