From 6cc9d78057182d40e483628be8f94e605cd94497 Mon Sep 17 00:00:00 2001 From: "kayos@tcp.direct" Date: Tue, 26 Oct 2021 19:51:14 -0700 Subject: [PATCH] Tidy up --- .gitignore | 3 +++ README.md | 7 +++++-- defs.go | 6 +++--- example/main.go | 9 +++++++-- setters.go | 4 ++-- util.go | 10 ---------- 6 files changed, 20 insertions(+), 19 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a83fceb --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/example/proxies.txt +/example/socks.list +/example/socksold.list diff --git a/README.md b/README.md index 304629a..898da86 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,17 @@ ## Prox5 + [![GoDoc](https://godoc.org/git.tcp.direct/kayos/Prox5?status.svg)](https://godoc.org/git.tcp.direct/kayos/Prox5) [![Go Report Card](https://goreportcard.com/badge/github.com/yunginnanet/Prox5)](https://goreportcard.com/report/github.com/yunginnanet/Prox5) [![IRC](https://img.shields.io/badge/ircd.chat-%23tcpdirect-blue.svg)](ircs://ircd.chat:6697/#tcpdirect) + ### SOCKS5/4/4a validating proxy pool ![Demo](./Prox5.gif) -This package is for managing and accessing thousands upon thousands of arbitrary SOCKS proxies. +This package is for managing and accessing thousands upon thousands of arbitrary SOCKS proxies. It also has a SOCKS5 server that dials out from ***?????*** Every time you ***?????***. -Pipe it a file filled with SOCKS proxies (host:port per line) and it will validate them continously while automatically weeding out the invalid ones. +Pipe it a file filled with SOCKS proxies (host:port per line) and it will validate them continously while automatically +weeding out the invalid ones. This project is in development. diff --git a/defs.go b/defs.go index ffa9441..288f5a1 100644 --- a/defs.go +++ b/defs.go @@ -206,10 +206,10 @@ func NewDefaultSwamp() *Swamp { swampopt: defOpt(), - quit: make(chan bool), + quit: make(chan bool), conductor: make(chan bool), - mu: &sync.RWMutex{}, - Status: atomic.Value{}, + mu: &sync.RWMutex{}, + Status: atomic.Value{}, } s.Status.Store(New) diff --git a/example/main.go b/example/main.go index 2d53f0c..799e2b2 100644 --- a/example/main.go +++ b/example/main.go @@ -13,6 +13,7 @@ import ( var swamp *Prox5.Swamp var quit chan bool +var t *tty.TTY func init() { quit = make(chan bool) @@ -50,7 +51,8 @@ func get(ver string) { } func watchKeyPresses() { - t, err := tty.Open() + var err error + t, err = tty.Open() if err != nil { panic(err) } @@ -104,7 +106,6 @@ func watchKeyPresses() { } } - t.Close() quit <- true return } @@ -112,6 +113,10 @@ func watchKeyPresses() { func main() { go watchKeyPresses() + defer func(t *tty.TTY) { + _ = t.Close() + }(t) + go func() { for { fmt.Printf("4: %d, 4a: %d, 5: %d \n", swamp.Stats.Valid4, swamp.Stats.Valid4a, swamp.Stats.Valid5) diff --git a/setters.go b/setters.go index 280c94b..b472e8d 100644 --- a/setters.go +++ b/setters.go @@ -47,12 +47,12 @@ func (s *Swamp) SetMaxWorkers(num int) { s.pool.Tune(num) } -// EnableRecycling disables recycling used proxies back into the pending channel for revalidation after dispensed. +// EnableRecycling enables recycling used proxies back into the pending channel for revalidation after dispensed. func (s *Swamp) EnableRecycling() { s.swampopt.recycle.Store(true) } -// DisableRecycling enables recycling used proxies back into the pending channel for revalidation after dispensed. +// DisableRecycling disables recycling used proxies back into the pending channel for revalidation after dispensed. func (s *Swamp) DisableRecycling() { s.swampopt.recycle.Store(false) } diff --git a/util.go b/util.go index 7fcb30c..29c7d0a 100644 --- a/util.go +++ b/util.go @@ -32,13 +32,3 @@ func randSleep() { quiccmaffs.Seed(time.Now().UnixNano()) time.Sleep(time.Duration(quiccmaffs.Intn(500)) * time.Millisecond) } - -/*func allNil(obj ...interface{}) bool { - for _, o := range obj { - if o != nil { - return false - } - } - return true -} -*/