-
Notifications
You must be signed in to change notification settings - Fork 188
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
refactor: create re-usable Shadowsocks service #206
Conversation
This reverts commit 1259af8.
metrics ServiceMetrics | ||
ciphers CipherList | ||
natTimeout time.Duration | ||
replayCache *ReplayCache |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the replayCache be nil?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it can. The implementation of ReplayCache
includes a safeguard against nil
pointers:
outline-ss-server/service/replay.go
Line 83 in 4463b38
if c == nil || c.capacity == 0 { |
That's probably why we don't explicitly safeguard against it in NewShadowsocksStreamAuthenticator()
. I'm not sure if this pattern is idiomatic in Go?
This service will be shared by Caddy module in forthcoming PR.