googleapis / google-cloud-go

Google Cloud Client Libraries for Go.
https://cloud.google.com/go/docs/reference
Apache License 2.0
3.77k stars 1.3k forks source link

httpreplay: enable to specify proxy listen address #7087

Closed nktks closed 1 year ago

nktks commented 1 year ago

Is your feature request related to a problem? Please describe. In my macOS Monterey(12.6.1), if execute like below code, os display popup like this(sorry popup lang is japanese).

package main

import (
    "encoding/json"
    "log"
    "time"

    "cloud.google.com/go/httpreplay"
)

func main() {
    now := time.Now()
    b, err := json.Marshal(now)
    if err != nil {
        log.Fatal(err)
    }
    _, err = httpreplay.NewRecorder("test", b)
    if err != nil {
        log.Fatal(err)
    }
    time.Sleep(10 * time.Second)
}
go run main.go
image

This is because the httpreplay proxy listens on anycast IP 0.0.0.0 at here Listening to anycast IP is not a problem itself, but it's a little annoying to get a popup every time we run a test on macOS.

Describe the solution you'd like When we want to use proxy only from locahost, enabling to use 127.0.0.1 is little useful. How do you think about this?

Describe alternatives you've considered I think fixing to 127.0.0.1 may not work if there is a case to access proxy from other host

nktks commented 1 year ago

Thank you!