-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Initialize saltfilter on demand #189
Conversation
@riobard, would you mind reviewing this? |
@fortuna Could you please isolate the singleton use case to the Maybe we should dump all ENV VARs and make them command line flags instead? Sorry I'm on a road trip right now, please correct me if there's any misunderstanding. And thanks a lot for this PR! :) |
I've restored the original internal interface and reverted all call sites. Does that address your concern? I didn't change to manual initialization because that may break callers. It's still on-demand. |
My view on flags and ENV: those should all live in binaries, not libraries. Libraries should provide ways to inject parameters, so that each caller can tweak to their needs. For example, in outline-ss-server, we inject a salt generator: https://github.com/Jigsaw-Code/outline-ss-server/blob/ac58257355e60b06f8d00d22128a7dd85cbde3e1/shadowsocks/stream.go#L45 |
Let's make the change for now, and I'll think about how to properly fix it once I finish the road trip. |
To clarify a point made at #165 (comment), the filter is an issue not only for using the code as a library, but also for the go-shadowsocks2 client. Having replay protection on the client is overkill. |
Initialize saltfilter on demand
This fixes the problem of allocating a lot of unnecessary memory on clients.