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

Allow Option to set quic.Config{}.KeepAlivePeriod #2779

Closed
zeisler opened this issue May 1, 2024 · 3 comments
Closed

Allow Option to set quic.Config{}.KeepAlivePeriod #2779

zeisler opened this issue May 1, 2024 · 3 comments

Comments

@zeisler
Copy link

zeisler commented May 1, 2024

I'm requesting the ability to set the KeepAlivePeriod for quic connections.

KeepAlivePeriod: 15 * time.Second,

When rebooting an upstream node and I'd like the downstream node to notice it's disconnected quicker so it can find a new node.

@marten-seemann
Copy link
Contributor

Are you familiar with QUIC Stateless Resets? They should solve this problem: https://quic-go.net/docs/quic/transport/#stateless-reset

@zeisler
Copy link
Author

zeisler commented May 1, 2024

Does this mean that as long as the private key is constant this should already work?

@marten-seemann
Copy link
Contributor

Yes, and the stateless reset key is derived from the node's libp2p (private) key:

go-libp2p/config/quic.go

Lines 19 to 30 in 0385ec9

func PrivKeyToStatelessResetKey(key crypto.PrivKey) (quic.StatelessResetKey, error) {
var statelessResetKey quic.StatelessResetKey
keyBytes, err := key.Raw()
if err != nil {
return statelessResetKey, err
}
keyReader := hkdf.New(sha256.New, keyBytes, nil, []byte(statelessResetKeyInfo))
if _, err := io.ReadFull(keyReader, statelessResetKey[:]); err != nil {
return statelessResetKey, err
}
return statelessResetKey, nil
}

@zeisler zeisler closed this as completed May 3, 2024
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