fix: use localhost instead of 127.0.0.1

This commit is contained in:
lilong.129
2025-05-27 20:16:10 +08:00
parent 866cc0e4d2
commit 229fd4678c
5 changed files with 5 additions and 4 deletions

View File

@@ -1 +1 @@
v5.0.0-beta-2505271946 v5.0.0-beta-2505272016

View File

@@ -5,6 +5,7 @@ echo "SCRIPT_DIR:, $SCRIPT_DIR"
# assume the script is always in <repository>/scripts # assume the script is always in <repository>/scripts
pushd "$SCRIPT_DIR/.." >/dev/null pushd "$SCRIPT_DIR/.." >/dev/null
mkdir -p .git/hooks
PRE_COMMIT_FILE=.git/hooks/pre-commit PRE_COMMIT_FILE=.git/hooks/pre-commit
# install pre-commit hook and make it executable # install pre-commit hook and make it executable

View File

@@ -86,7 +86,7 @@ func (r *Router) Init() {
} }
func (r *Router) Run(port int) error { func (r *Router) Run(port int) error {
err := r.Engine.Run(fmt.Sprintf("127.0.0.1:%d", port)) err := r.Engine.Run(fmt.Sprintf("localhost:%d", port))
if err != nil { if err != nil {
log.Err(err).Msg("failed to start http server") log.Err(err).Msg("failed to start http server")
return err return err

View File

@@ -272,7 +272,7 @@ func (s *DriverSession) Request(method string, urlStr string, rawBody []byte) (
func (s *DriverSession) SetupPortForward(localPort int) error { func (s *DriverSession) SetupPortForward(localPort int) error {
s.client.Transport = &http.Transport{ s.client.Transport = &http.Transport{
DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) { DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) {
return net.Dial(network, fmt.Sprintf("127.0.0.1:%d", localPort)) return net.Dial(network, fmt.Sprintf("localhost:%d", localPort))
}, },
MaxIdleConns: 10, MaxIdleConns: 10,
IdleConnTimeout: 30 * time.Second, IdleConnTimeout: 30 * time.Second,

View File

@@ -138,7 +138,7 @@ func (wd *WDADriver) Setup() error {
if err != nil { if err != nil {
return err return err
} }
wd.Session.SetBaseURL(fmt.Sprintf("http://127.0.0.1:%d", localPort)) wd.Session.SetBaseURL(fmt.Sprintf("http://localhost:%d", localPort))
if err = wd.initMjpegClient(); err != nil { if err = wd.initMjpegClient(); err != nil {
return err return err