28 lines
544 B
Go
28 lines
544 B
Go
/*
|
|
* Copyright 2026 Oleg Borodin <onborodin@gmail.com>
|
|
*/
|
|
package handler
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"mproxy/app/proxoper"
|
|
"mproxy/app/router"
|
|
)
|
|
|
|
func (hand *Handler) ConnectTo(rctx *router.Context) {
|
|
hostaddr, _ := rctx.GetSubpath("hostaddr")
|
|
params := &proxoper.ConnectToParams{
|
|
Hostaddr: hostaddr,
|
|
}
|
|
ctx := rctx.GetContext()
|
|
_, err := hand.prop.ConnectTo(ctx, params)
|
|
if err != nil {
|
|
hand.logg.Errorf("ConnectTo error: %v", err)
|
|
rctx.SetStatus(http.StatusInternalServerError)
|
|
return
|
|
}
|
|
rctx.SetStatus(http.StatusOK)
|
|
return
|
|
}
|