Refactor: move Start operation out of LoadProxyTXT

This commit is contained in:
kayos@tcp.direct 2021-09-14 00:35:04 -07:00
parent 7faea867f5
commit c3d92d723a
2 changed files with 9 additions and 6 deletions

@ -19,12 +19,6 @@ func (s *Swamp) LoadProxyTXT(seedFile string) error {
scan := bufio.NewScanner(f)
if !s.started {
go s.tossUp()
go s.feed()
s.started = true
}
for scan.Scan() {
s.mu.Lock()
s.scvm = append(s.scvm, scan.Text())

@ -6,6 +6,15 @@ const (
rst = "\033[0m"
)
// Start starts our proxy pool operations. Trying to start a running Swamp is a nonop.
func (s *Swamp) Start() {
if !s.started {
go s.tossUp()
go s.feed()
s.started = true
}
}
/*
Pause will cease the creation of any new proxy validation operations.
* You will be able to start the proxy pool again with Swamp.Resume(), it will have the same Statistics, options, and ratelimits.