mirror of
https://github.com/hanzo-ml/kuberay.git
synced 2026-10-30 19:48:47 +00:00
33 lines
627 B
Go
33 lines
627 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, port int) {
|
|
r.httpProxyURL = fmt.Sprintf("http://%s:%d", hostIp, port)
|
|
}
|
|
|
|
func (r *FakeRayHttpProxyClient) CheckHealth() error {
|
|
// TODO: test check return error cases.
|
|
// Always return successful.
|
|
return nil
|
|
}
|