the uri should already be valid maybe

This commit is contained in:
kayos@tcp.direct 2021-10-23 07:32:33 -07:00
parent 2eaeb6c3fd
commit 3e507c41a5
2 changed files with 3 additions and 20 deletions

@ -3,11 +3,9 @@ package Prox5
import (
"errors"
"strconv"
"strings"
"sync"
)
func (s *Swamp) svcUp() {
s.mu.Lock()
s.runningdaemons++
@ -37,28 +35,20 @@ func (sm swampMap) add(sock string) (*Proxy, bool) {
sm.mu.Lock()
defer sm.mu.Unlock()
var auth = &proxyAuth{}
if strings.Contains(sock, "@") {
split := strings.Split(sock, "@")
sock = split[1]
authsplit := strings.Split(split[0], ":")
auth.username = authsplit[0]
auth.password = authsplit[1]
}
if sm.exists(sock) {
return nil, false
}
p := &Proxy{
Endpoint: sock,
lock: stateUnlocked,
parent: sm.parent,
}
p.timesValidated.Store(0)
p.timesBad.Store(0)
sm.plot[sock] = p
return p, true
return sm.plot[sock], true
}
func (sm swampMap) exists(sock string) bool {

@ -154,11 +154,6 @@ const (
stateLocked
)
type proxyAuth struct {
username string
password string
}
// Proxy represents an individual proxy
type Proxy struct {
// Endpoint is the address:port of the proxy that we connect to
@ -174,8 +169,6 @@ type Proxy struct {
// timesBad is the amount of times the proxy has been marked as bad.
timesBad atomic.Value
auth *proxyAuth
parent *Swamp
lock uint32
}