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

[WIP] Implement a simple TCPProxy filter #255

Closed
wants to merge 2 commits into from

Conversation

nevill
Copy link
Contributor

@nevill nevill commented Sep 14, 2021

Yes, I see @jxd134 's PR #234 there, but I cannot really run the code there (got a panic when starting server).

This PR is a quick concept proof as discussed in #229 (comment). I think we can have further discussion based on a working code base.

To play with filter TCPPorxy, you have to config with it, like

---
kind: HTTPServer
name: server-demo
port: 10080
keepAlive: true
https: false
rules:
  - paths:
      - pathPrefix: /tcp
        backend: tcp-demo
---
kind: HTTPPipeline
name: tcp-demo
flow:
  - filter: proxy
filters:
  - name: proxy
    kind: TCPProxy
    servers:
      - url: tcp://127.0.0.1:9095
      - url: tcp://127.0.0.1:9096
      - url: tcp://127.0.0.1:9097

Then you can go run example/backend-service/mirror/mirror.go to start the back-end servers, try to curl it, like

curl -v example.com:10080/tcp
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to example.com (127.0.0.1) port 10080 (#0)
> GET /tcp HTTP/1.1
> Host: example.com:10080
> User-Agent: curl/7.64.1
> Accept: */*
> 
< HTTP/1.1 200 OK
< Content-Length: 170
< Content-Type: text/plain; charset=utf-8
< Date: Tue, 14 Sep 2021 02:36:32 GMT
< 
Your Request
==============
Method: GET
Host: example.com:10080
URL   : /tcp
Header:
    Accept: [*/*]
    Accept-Encoding: [gzip]
    User-Agent: [curl/7.64.1]
Body  : 
* Connection #0 to host example.com left intact
* Closing connection 0

@codecov-commenter
Copy link

codecov-commenter commented Sep 14, 2021

Codecov Report

Merging #255 (d478cfc) into main (a915688) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #255   +/-   ##
=======================================
  Coverage   80.12%   80.12%           
=======================================
  Files          44       44           
  Lines        4835     4835           
=======================================
  Hits         3874     3874           
  Misses        740      740           
  Partials      221      221           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a915688...d478cfc. Read the comment docs.

@jxd134
Copy link
Contributor

jxd134 commented Sep 14, 2021

@nevill my tcp proxy code is incomplete.

Copy link

@megaeasex megaeasex left a comment

Choose a reason for hiding this comment

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

[TASK:easegress-pr-test FAILED]megaease/easegress Pull Request 255 Deploy Test failed

@nevill
Copy link
Contributor Author

nevill commented Oct 19, 2021

Since #234 is ready to review, closing this one.

@nevill nevill closed this Oct 19, 2021
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.

4 participants