Skip to content

feat: add QUIC server support#423

Open
juniorjse wants to merge 28 commits into
topfreegames:mainfrom
juniorjse:feature/quic-server
Open

feat: add QUIC server support#423
juniorjse wants to merge 28 commits into
topfreegames:mainfrom
juniorjse:feature/quic-server

Conversation

@juniorjse

Copy link
Copy Markdown

Enable support for QUIC protocol to expand connection options in supported environments.

junior.silva and others added 20 commits October 7, 2024 15:56
- Modified GetAddr, GetConnChan
- Added EnableProxyProtocol, IsRunning, GetConfiguredAddress, ListenAndServe
- Updated Read, Write methods
- Implemented GetNextMessage
- Removed SetDeadline methods
- Modified GetAddr, GetConnChan
- Added EnableProxyProtocol, IsRunning, GetConfiguredAddress, ListenAndServe
- Updated Read, Write methods
- Implemented GetNextMessage
- Removed SetDeadline methods
Comment thread examples/demo/cluster_grpc/main_quic.go Outdated
}

// EnableProxyProtocol not implemented for QUIC, keep as No-op or implement as needed
func (a *QuicAcceptor) EnableProxyProtocol() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@guthyerrz I think it's important to understand who's using proxy protocol and what's the use case, so we evaluate if we need to implement this right away or not

Comment thread pkg/acceptor/quic_acceptor.go Outdated

// Write writes data to the connection with a defined deadline
func (q *QuicConnWrapper) Write(p []byte) (int, error) {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) // 5 seconds timeout as an example

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Make this timeout configurable instead of hardcoding it here

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I'll do it


// Close closes the QUIC connection
func (q *QuicConnWrapper) Close() error {
return q.conn.CloseWithError(0, "closed")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Didn't really read the API here, but do all connections need to be closed with errors?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The quic-go documentation specifies that to close a connection you must use CloseWithError, as there is no simple Close() method. quic-go does not provide a way to close the connection without reporting an error code and message

Comment thread pkg/acceptor/quic_acceptor.go Outdated

// GetNextMessage reads the next message available in the QUIC stream
func (q *QuicConnWrapper) GetNextMessage() (b []byte, err error) {
// Read data from the stream

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can't you leverage io utilities that go provides in this method, just like we do for the tcp acceptor?
https://github.com/topfreegames/pitaya/blob/main/pkg/acceptor/tcp_acceptor.go#L55-L74

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

also, you seem to be assuming the maximum size of a message will be 1024 bytes, which is inaccurate

junior.silva and others added 8 commits November 11, 2024 15:01
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

Successfully merging this pull request may close these issues.

2 participants