mirror of
https://github.com/hanzo-ml/kuberay.git
synced 2026-10-30 19:48:47 +00:00
* draft for serving service * add http proxy health check and http proxy service * address comments * add unit tests * fix ut * update ut * update * address comment and add TODO Co-authored-by: Bruce Zhang <[email protected]>
33 lines
632 B
Go
33 lines
632 B
Go
package utils
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
"time"
|
|
)
|
|
|
|
func GetFakeRayHttpProxyClient() RayHttpProxyClientInterface {
|
|
return &FakeRayHttpProxyClient{}
|
|
}
|
|
|
|
type FakeRayHttpProxyClient struct {
|
|
client http.Client
|
|
httpProxyURL string
|
|
}
|
|
|
|
func (r *FakeRayHttpProxyClient) InitClient() {
|
|
r.client = http.Client{
|
|
Timeout: 20 * time.Millisecond,
|
|
}
|
|
}
|
|
|
|
func (r *FakeRayHttpProxyClient) SetHostIp(hostIp string) {
|
|
r.httpProxyURL = fmt.Sprint("http://", hostIp, ":", DefaultHttpProxyPort)
|
|
}
|
|
|
|
func (r *FakeRayHttpProxyClient) CheckHealth() error {
|
|
// TODO: test check return error cases.
|
|
// Always return successful.
|
|
return nil
|
|
}
|