mirror of
https://github.com/cirruslabs/orchard.git
synced 2026-09-29 19:41:15 +02:00
Load testing: synthetic VMs, multiple worker support and Grafana k6 test (#389)
* Load testing: synthetic VMs, multiple worker support and Grafana k6 test * echoserver: prevent fallthrough when Accept() fails * Move default local-dev context logic to CreateDevController() * Synthetic: add a random delay to startup script echoing
This commit is contained in:
@@ -16,6 +16,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/cirruslabs/orchard/internal/config"
|
||||
"github.com/cirruslabs/orchard/internal/dialer"
|
||||
"github.com/cirruslabs/orchard/internal/version"
|
||||
"github.com/cirruslabs/orchard/rpc"
|
||||
"github.com/coder/websocket"
|
||||
@@ -42,7 +43,7 @@ type Client struct {
|
||||
serviceAccountName string
|
||||
serviceAccountToken string
|
||||
|
||||
dialContext func(ctx context.Context, network, addr string) (net.Conn, error)
|
||||
dialer dialer.Dialer
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
@@ -84,8 +85,8 @@ func New(opts ...Option) (*Client, error) {
|
||||
TLSClientConfig: client.tlsConfig,
|
||||
}
|
||||
|
||||
if client.dialContext != nil {
|
||||
transport.DialContext = client.dialContext
|
||||
if client.dialer != nil {
|
||||
transport.DialContext = client.dialer.DialContext
|
||||
}
|
||||
|
||||
client.httpClient = &http.Client{
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/x509"
|
||||
"net"
|
||||
|
||||
"github.com/cirruslabs/orchard/internal/dialer"
|
||||
)
|
||||
|
||||
type Option func(*Client)
|
||||
@@ -27,8 +27,8 @@ func WithCredentials(serviceAccountName string, serviceAccountToken string) Opti
|
||||
}
|
||||
}
|
||||
|
||||
func WithDialContext(dialContext func(ctx context.Context, network, addr string) (net.Conn, error)) Option {
|
||||
func WithDialer(dialer dialer.Dialer) Option {
|
||||
return func(client *Client) {
|
||||
client.dialContext = dialContext
|
||||
client.dialer = dialer
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user