tokend: make sure Host is set to something sensible
This commit is contained in:
parent
b3e38809c3
commit
ca8f808647
1 changed files with 13 additions and 10 deletions
|
@ -215,8 +215,19 @@ func attachUserData(ctx context.Context, c net.Conn) context.Context {
|
|||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
d := &net.Dialer{
|
||||
Timeout: 30 * time.Second,
|
||||
KeepAlive: 30 * time.Second,
|
||||
}
|
||||
agentPath := strings.TrimPrefix(*agentAddr, "unix://")
|
||||
agentDialer := func(ctx context.Context, network, addr string) (net.Conn, error) {
|
||||
// Ignore what they want.
|
||||
return d.DialContext(ctx, "unix", agentPath)
|
||||
}
|
||||
|
||||
vcfg := vapi.DefaultConfig()
|
||||
vcfg.AgentAddress = *agentAddr
|
||||
vcfg.AgentAddress = "http://vault-agent"
|
||||
vcfg.HttpClient.Transport.(*http.Transport).DialContext = agentDialer
|
||||
v, err := vapi.NewClient(vcfg)
|
||||
if err != nil {
|
||||
log.Exitf("creating vault client against %v: %v", *agentAddr, err)
|
||||
|
@ -238,17 +249,9 @@ func main() {
|
|||
}
|
||||
}
|
||||
}()
|
||||
d := &net.Dialer{
|
||||
Timeout: 30 * time.Second,
|
||||
KeepAlive: 30 * time.Second,
|
||||
}
|
||||
agentPath := strings.TrimPrefix(*agentAddr, "unix://")
|
||||
vp := &vaultProxier{v: v, c: c, hc: &http.Client{
|
||||
Transport: &http.Transport{
|
||||
DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) {
|
||||
// Ignore what they want.
|
||||
return d.DialContext(ctx, "unix", agentPath)
|
||||
},
|
||||
DialContext: agentDialer,
|
||||
ForceAttemptHTTP2: true,
|
||||
MaxIdleConns: 100,
|
||||
IdleConnTimeout: 90 * time.Second,
|
||||
|
|
Loading…
Reference in a new issue