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

feat(client): disable TCP Keep-Alive to save battery #2000

Merged
merged 3 commits into from
Apr 25, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion outline/device/stream_dialer.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@
package device

import (
"net"

"github.com/Jigsaw-Code/outline-sdk/transport"
"github.com/Jigsaw-Code/outline-sdk/transport/shadowsocks"
)

// newOutlineStreamDialer creates a [transport.StreamDialer] that connects to the remote proxy using `config`.
func newOutlineStreamDialer(config *transportConfig) (transport.StreamDialer, error) {
dialer, err := shadowsocks.NewStreamDialer(&transport.TCPEndpoint{Address: config.RemoteAddress}, config.CryptoKey)
// We disable Keep-Alive as per https://datatracker.ietf.org/doc/html/rfc1122#page-101, which states that it should only be
Copy link
Contributor

@jyyi1 jyyi1 Apr 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remembered we should have already removed all code from outline/device? #1972

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I was on an outdated master. Updated.

// enabled in server applications. This prevents the device from unnecessarily waking up to send keep alives.
dialer, err := shadowsocks.NewStreamDialer(&transport.TCPEndpoint{Address: config.RemoteAddress, Dialer: net.Dialer{KeepAlive: -1}}, config.CryptoKey)
if err != nil {
return nil, err
}
Expand Down
Loading