Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proxy pool #32

Open
shotzzgfx opened this issue Aug 6, 2022 · 4 comments
Open

Proxy pool #32

shotzzgfx opened this issue Aug 6, 2022 · 4 comments

Comments

@shotzzgfx
Copy link

hey, is there any way to have the library forward the request to use one of 50,000 proxies? A pool of proxies. Thanks!

@yeqown
Copy link
Owner

yeqown commented Aug 11, 2022

Do you mean 50,000 proxy connection pool, or 50,000 backend server?

@shotzzgfx
Copy link
Author

50,000 proxy connection pool

@yeqown
Copy link
Owner

yeqown commented Aug 12, 2022

Check these lines of code:

// NewChanPool to new a pool with some params
func NewChanPool(initialCap, maxCap int, factory Factory) (Pool, error) {
if initialCap < 0 || maxCap <= 0 || initialCap > maxCap {
return nil, errInvalidCapacitySetting
}
// initialize the chanPool
pool := &chanPool{
mutex: sync.RWMutex{},
reverseProxyChan: make(chan *ReverseProxy, maxCap),
factory: factory,
}
// create initial connections, if something goes wrong,
// just close the pool error out.
for i := 0; i < initialCap; i++ {
proxy, err := factory("")
if err != nil {
proxy.Close()
return nil, errFactoryNotHelp
}
pool.reverseProxyChan <- proxy
}
return pool, nil
}

@shotzzgfx
Copy link
Author

Could you show an example with loading proxies?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants