mirror of
https://github.com/bettercap/bettercap
synced 2025-08-14 02:36:57 -07:00
balls
This commit is contained in:
parent
6e6eb688d7
commit
1cffa33264
7 changed files with 74 additions and 75 deletions
|
@ -13,7 +13,6 @@ import (
|
|||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/evilsocket/bettercap-ng/core"
|
||||
|
@ -169,32 +168,6 @@ func (p *HTTPProxy) Configure(address string, proxyPort int, httpPort int, scrip
|
|||
return nil
|
||||
}
|
||||
|
||||
var (
|
||||
certCache = make(map[string]*tls.Certificate)
|
||||
certLock = &sync.Mutex{}
|
||||
)
|
||||
|
||||
func getCachedCert(domain string, port int) *tls.Certificate {
|
||||
key := fmt.Sprintf("%s:%d", domain, port)
|
||||
|
||||
certLock.Lock()
|
||||
defer certLock.Unlock()
|
||||
|
||||
if cert, found := certCache[key]; found == true {
|
||||
return cert
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func setCachedCert(domain string, port int, cert *tls.Certificate) {
|
||||
key := fmt.Sprintf("%s:%d", domain, port)
|
||||
|
||||
certLock.Lock()
|
||||
defer certLock.Unlock()
|
||||
|
||||
certCache[key] = cert
|
||||
}
|
||||
|
||||
func TLSConfigFromCA(ca *tls.Certificate) func(host string, ctx *goproxy.ProxyCtx) (*tls.Config, error) {
|
||||
return func(host string, ctx *goproxy.ProxyCtx) (c *tls.Config, err error) {
|
||||
parts := strings.SplitN(host, ":", 2)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue