Files
go-sip/cmd/sip-go-agent/dispatcher_http.go
T

26 lines
627 B
Go

package main
import (
"fmt"
"net/http"
"time"
)
func dispatcherSaaSHTTPClient(mode string, mockTrustPEM []byte) (*http.Client, error) {
switch mode {
case "nonprod-real", "sip-only":
// SaaS uses the standard transport and system certificate roots, not
// the Agent mTLS CA or Mock's loopback-only transport.
return &http.Client{Timeout: 10 * time.Second}, nil
case "mock":
client, err := localMockHTTPClient(mockTrustPEM)
if err != nil {
return nil, err
}
client.Timeout = 10 * time.Second
return client, nil
default:
return nil, fmt.Errorf("unsupported Dispatcher SaaS HTTP mode %q", mode)
}
}