(ctx context.Context, originProxy connection.OriginProxy, originAddr string, w http.ResponseWriter, reqBody io.ReadCloser)
| 498 | } |
| 499 | |
| 500 | func proxyTCP(ctx context.Context, originProxy connection.OriginProxy, originAddr string, w http.ResponseWriter, reqBody io.ReadCloser) error { |
| 501 | req, err := http.NewRequest(http.MethodGet, fmt.Sprintf("http://%s", originAddr), reqBody) |
| 502 | if err != nil { |
| 503 | return err |
| 504 | } |
| 505 | |
| 506 | log := zerolog.Nop() |
| 507 | respWriter, err := connection.NewHTTP2RespWriter(req, w, connection.TypeTCP, &log) |
| 508 | if err != nil { |
| 509 | return err |
| 510 | } |
| 511 | |
| 512 | tcpReq := &connection.TCPRequest{ |
| 513 | Dest: originAddr, |
| 514 | CFRay: "123", |
| 515 | LBProbe: false, |
| 516 | } |
| 517 | rws := connection.NewHTTPResponseReadWriterAcker(respWriter, w.(http.Flusher), req) |
| 518 | |
| 519 | return originProxy.ProxyTCP(ctx, rws, tcpReq) |
| 520 | } |
| 521 | |
| 522 | func serveTCPOrigin(t *testing.T, tcpOrigin net.Listener, wg *sync.WaitGroup) { |
| 523 | for { |
no test coverage detected