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

add WebSocketProxy and remove WebSocketServer #802

Merged
merged 11 commits into from
Sep 28, 2022
Merged

add WebSocketProxy and remove WebSocketServer #802

merged 11 commits into from
Sep 28, 2022

Conversation

localvar
Copy link
Collaborator

No description provided.

@codecov-commenter
Copy link

codecov-commenter commented Sep 23, 2022

Codecov Report

Base: 78.83% // Head: 79.12% // Increases project coverage by +0.29% 🎉

Coverage data is based on head (9d18514) compared to base (d207f05).
Patch coverage: 80.75% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #802      +/-   ##
==========================================
+ Coverage   78.83%   79.12%   +0.29%     
==========================================
  Files         101      101              
  Lines       11170    11144      -26     
==========================================
+ Hits         8806     8818      +12     
+ Misses       1859     1830      -29     
+ Partials      505      496       -9     
Impacted Files Coverage Δ
pkg/object/httpserver/mux.go 87.24% <73.68%> (-0.41%) ⬇️
pkg/filters/proxy/basepool.go 73.80% <73.80%> (ø)
pkg/filters/proxy/wspool.go 75.18% <75.18%> (ø)
pkg/filters/proxy/pool.go 80.05% <100.00%> (+4.05%) ⬆️
pkg/filters/proxy/wsproxy.go 100.00% <100.00%> (ø)
pkg/object/meshcontroller/spec/builder.go 79.91% <100.00%> (+0.32%) ⬆️
pkg/filters/proxy/proxy.go 95.95% <0.00%> (+11.56%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

// WebSocketProxyKind is the kind of WebSocketProxy.
const WebSocketProxyKind = "WebSocketProxy"

var kindWebSocketProxy = &filters.Kind{
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO, it's better to split every filter into different directories even they have the same infrastructure, which makes the layout clean and has no particular case.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

because the two filters share a lot of code, and the limit time for implement this feature, we have to balance between:

  • put them in the same folder
  • duplicate the code

and I think the 2nd is worse.

we can do a refactor to put them into different folders later, this only require code level changes, and won't impact the external interface, so we can do it at any time.

As I mentioned before, because we are now using Go 1.18, it is possible for us to extract the load balance and request matching stuff into seperate packages, and I think it will be easier for us to do the refactor after that.

Copy link
Contributor

Choose a reason for hiding this comment

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

Your argument makes sense to me. The only thing I was curious about is why different folders mean duplicating code with exporting infrastructure.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the shared code including:

  • load balance
  • request matching
  • service discovery

if I put the filters into different folders, and avoid code duplication at the same time, I need to extract them into seperate packages, but, I don't have enough time to make a good design for the interfaces of the new packages (in fact, I already did some refactor towards this, e.g. extract service discovery to the BaseServerPool struct).

Copy link
Collaborator

Choose a reason for hiding this comment

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

If we compromise this for time cost, I think we should add some TODO comments in the implementation to remind us to refactor it in the future.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

sure, added.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, the real problem is no time to design interfaces instead of inevitable duplicate code.

@xxx7xxxx xxx7xxxx merged commit 5582774 into easegress-io:main Sep 28, 2022
@localvar localvar deleted the websocket branch September 28, 2022 09:32
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.

None yet

5 participants