Connects to the internal RPC server and returns a new invoker for it
(ctx context.Context, fwd portforwarder.PortForwarder)
| 62 | |
| 63 | // Connects to the internal RPC server and returns a new invoker for it |
| 64 | func CreateInvoker(ctx context.Context, fwd portforwarder.PortForwarder) (Invoker, error) { |
| 65 | ctx, cancel := context.WithTimeout(ctx, ConnectionTimeout) |
| 66 | defer cancel() |
| 67 | |
| 68 | invoker, err := connect(ctx, fwd) |
| 69 | if err != nil { |
| 70 | return nil, fmt.Errorf("error connecting to internal server: %w", err) |
| 71 | } |
| 72 | |
| 73 | return invoker, nil |
| 74 | } |
| 75 | |
| 76 | // Finds a free port to listen on and creates a new RPC invoker that connects to that port |
| 77 | func connect(ctx context.Context, fwd portforwarder.PortForwarder) (Invoker, error) { |