mirror of
https://github.com/cirruslabs/tart-guest-agent.git
synced 2026-09-29 19:31:10 +02:00
Expose Protocol Buffers/gRPC bindings (#66)
* Expose Protocol Buffers/gRPC bindings * CI: pin used actions
This commit is contained in:
@@ -18,14 +18,14 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-go@v6
|
||||
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
||||
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
- name: Install system dependencies
|
||||
run: sudo apt-get update && sudo apt-get install --yes libx11-dev
|
||||
- uses: golangci/golangci-lint-action@v9
|
||||
- uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9
|
||||
with:
|
||||
version: v2.12.0
|
||||
only-new-issues: true
|
||||
@@ -35,8 +35,8 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-go@v6
|
||||
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
||||
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
@@ -50,8 +50,8 @@ jobs:
|
||||
runs-on: macos-26
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-go@v6
|
||||
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
||||
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
version: v2
|
||||
plugins:
|
||||
- remote: buf.build/protocolbuffers/go:v1.36.6
|
||||
out: internal/
|
||||
out: pkg/
|
||||
opt: paths=source_relative
|
||||
- remote: buf.build/grpc/go:v1.5.1
|
||||
out: internal/
|
||||
out: pkg/
|
||||
opt: paths=source_relative
|
||||
|
||||
+31
-29
@@ -13,6 +13,7 @@ import (
|
||||
"syscall"
|
||||
|
||||
"github.com/cirruslabs/tart-guest-agent/internal/execuser"
|
||||
"github.com/cirruslabs/tart-guest-agent/pkg/v1"
|
||||
"github.com/creack/pty"
|
||||
"github.com/google/uuid"
|
||||
"github.com/samber/lo"
|
||||
@@ -35,13 +36,14 @@ const (
|
||||
signalExitCodeOffset = 128
|
||||
)
|
||||
|
||||
func (rpc *RPC) Exec(stream grpc.BidiStreamingServer[ExecRequest, ExecResponse]) error {
|
||||
//nolint:gocognit,gocyclo,maintidx // Exec coordinates process startup, bidirectional I/O, and cleanup.
|
||||
func (rpc *RPC) Exec(stream grpc.BidiStreamingServer[v1.ExecRequest, v1.ExecResponse]) error {
|
||||
// Read the first exec request, it should describe a command to execute
|
||||
firstExecRequest, err := stream.Recv()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
firstExecRequestCommand, ok := firstExecRequest.Type.(*ExecRequest_Command_)
|
||||
firstExecRequestCommand, ok := firstExecRequest.GetType().(*v1.ExecRequest_Command_)
|
||||
if !ok {
|
||||
return fmt.Errorf("first exec request should describe a command to execute")
|
||||
}
|
||||
@@ -96,9 +98,9 @@ func (rpc *RPC) Exec(stream grpc.BidiStreamingServer[ExecRequest, ExecResponse])
|
||||
return err
|
||||
}
|
||||
|
||||
if err := stream.Send(&ExecResponse{
|
||||
Type: &ExecResponse_Exit_{
|
||||
Exit: &ExecResponse_Exit{
|
||||
if err := stream.Send(&v1.ExecResponse{
|
||||
Type: &v1.ExecResponse_Exit_{
|
||||
Exit: &v1.ExecResponse_Exit{
|
||||
Code: 0,
|
||||
},
|
||||
},
|
||||
@@ -209,7 +211,7 @@ func (rpc *RPC) Exec(stream grpc.BidiStreamingServer[ExecRequest, ExecResponse])
|
||||
}
|
||||
|
||||
switch typedAction := request.Type.(type) {
|
||||
case *ExecRequest_StandardInput:
|
||||
case *v1.ExecRequest_StandardInput:
|
||||
if !firstExecRequestCommand.Command.Interactive {
|
||||
// Ignore standard input from the client
|
||||
// as non-interactive command is running
|
||||
@@ -232,7 +234,7 @@ func (rpc *RPC) Exec(stream grpc.BidiStreamingServer[ExecRequest, ExecResponse])
|
||||
|
||||
return
|
||||
}
|
||||
case *ExecRequest_TerminalResize:
|
||||
case *v1.ExecRequest_TerminalResize:
|
||||
// Ignore terminal resize requests
|
||||
// when pseudo terminal is disabled
|
||||
if !firstExecRequestCommand.Command.Tty {
|
||||
@@ -254,7 +256,7 @@ func (rpc *RPC) Exec(stream grpc.BidiStreamingServer[ExecRequest, ExecResponse])
|
||||
// Serialize responses from the stdout and stderr goroutines
|
||||
var sendMutex sync.Mutex
|
||||
|
||||
sendResponse := func(response *ExecResponse) error {
|
||||
sendResponse := func(response *v1.ExecResponse) error {
|
||||
sendMutex.Lock()
|
||||
defer sendMutex.Unlock()
|
||||
|
||||
@@ -282,9 +284,9 @@ func (rpc *RPC) Exec(stream grpc.BidiStreamingServer[ExecRequest, ExecResponse])
|
||||
return err
|
||||
}
|
||||
|
||||
if err := sendResponse(&ExecResponse{
|
||||
Type: &ExecResponse_StandardOutput{
|
||||
StandardOutput: &IOChunk{
|
||||
if err := sendResponse(&v1.ExecResponse{
|
||||
Type: &v1.ExecResponse_StandardOutput{
|
||||
StandardOutput: &v1.IOChunk{
|
||||
Data: slices.Clone(buf[:n]),
|
||||
},
|
||||
},
|
||||
@@ -312,9 +314,9 @@ func (rpc *RPC) Exec(stream grpc.BidiStreamingServer[ExecRequest, ExecResponse])
|
||||
return err
|
||||
}
|
||||
|
||||
if err := sendResponse(&ExecResponse{
|
||||
Type: &ExecResponse_StandardError{
|
||||
StandardError: &IOChunk{
|
||||
if err := sendResponse(&v1.ExecResponse{
|
||||
Type: &v1.ExecResponse_StandardError{
|
||||
StandardError: &v1.IOChunk{
|
||||
Data: slices.Clone(buf[:n]),
|
||||
},
|
||||
},
|
||||
@@ -358,9 +360,9 @@ func (rpc *RPC) Exec(stream grpc.BidiStreamingServer[ExecRequest, ExecResponse])
|
||||
}
|
||||
}
|
||||
|
||||
return stream.Send(&ExecResponse{
|
||||
Type: &ExecResponse_Exit_{
|
||||
Exit: &ExecResponse_Exit{
|
||||
return stream.Send(&v1.ExecResponse{
|
||||
Type: &v1.ExecResponse_Exit_{
|
||||
Exit: &v1.ExecResponse_Exit{
|
||||
Code: int32(exitCode),
|
||||
},
|
||||
},
|
||||
@@ -402,7 +404,7 @@ func closeStdin(stdin io.WriteCloser, tty bool, closed *bool) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (rpc *RPC) Signal(_ context.Context, request *SignalRequest) (*emptypb.Empty, error) {
|
||||
func (rpc *RPC) Signal(_ context.Context, request *v1.SignalRequest) (*emptypb.Empty, error) {
|
||||
process, ok := rpc.execs.Load(request.GetExecId())
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("exec %q is not running", request.GetExecId())
|
||||
@@ -411,9 +413,9 @@ func (rpc *RPC) Signal(_ context.Context, request *SignalRequest) (*emptypb.Empt
|
||||
var signal syscall.Signal
|
||||
|
||||
switch request.GetSignal() {
|
||||
case SignalRequest_SIGNAL_SIGTERM:
|
||||
case v1.SignalRequest_SIGNAL_SIGTERM:
|
||||
signal = syscall.SIGTERM
|
||||
case SignalRequest_SIGNAL_SIGKILL:
|
||||
case v1.SignalRequest_SIGNAL_SIGKILL:
|
||||
signal = syscall.SIGKILL
|
||||
default:
|
||||
return nil, fmt.Errorf("unsupported exec signal %q", request.GetSignal().String())
|
||||
@@ -431,27 +433,27 @@ func (rpc *RPC) Signal(_ context.Context, request *SignalRequest) (*emptypb.Empt
|
||||
return &emptypb.Empty{}, nil
|
||||
}
|
||||
|
||||
func sendStartSuccess(stream grpc.BidiStreamingServer[ExecRequest, ExecResponse], execID string) error {
|
||||
return stream.Send(&ExecResponse{
|
||||
Type: &ExecResponse_Started_{
|
||||
Started: &ExecResponse_Started{
|
||||
func sendStartSuccess(stream grpc.BidiStreamingServer[v1.ExecRequest, v1.ExecResponse], execID string) error {
|
||||
return stream.Send(&v1.ExecResponse{
|
||||
Type: &v1.ExecResponse_Started_{
|
||||
Started: &v1.ExecResponse_Started{
|
||||
ExecId: execID,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func sendStartFailure(stream grpc.BidiStreamingServer[ExecRequest, ExecResponse]) error {
|
||||
return stream.Send(&ExecResponse{
|
||||
Type: &ExecResponse_Exit_{
|
||||
Exit: &ExecResponse_Exit{
|
||||
func sendStartFailure(stream grpc.BidiStreamingServer[v1.ExecRequest, v1.ExecResponse]) error {
|
||||
return stream.Send(&v1.ExecResponse{
|
||||
Type: &v1.ExecResponse_Exit_{
|
||||
Exit: &v1.ExecResponse_Exit{
|
||||
Code: execRuntimeFailureExitCode,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func applyExecOverrides(cmd *exec.Cmd, command *ExecRequest_Command) error {
|
||||
func applyExecOverrides(cmd *exec.Cmd, command *v1.ExecRequest_Command) error {
|
||||
if command.Workdir != "" {
|
||||
cmd.Dir = command.Workdir
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/cirruslabs/tart-guest-agent/pkg/v1"
|
||||
"github.com/stretchr/testify/require"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
@@ -26,7 +27,7 @@ import (
|
||||
func TestExecGRPCBackgroundProcessLifetime(t *testing.T) {
|
||||
for _, mode := range []string{"normal exit", "cancel after exit", "cancel while running"} {
|
||||
t.Run(mode, func(t *testing.T) {
|
||||
client := NewAgentClient(newExecGRPCTestConn(t))
|
||||
client := v1.NewAgentClient(newExecGRPCTestConn(t))
|
||||
ctx, cancel := context.WithTimeout(t.Context(), execTestTimeout)
|
||||
defer cancel()
|
||||
|
||||
@@ -34,7 +35,7 @@ func TestExecGRPCBackgroundProcessLifetime(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
releasePath := filepath.Join(t.TempDir(), "release")
|
||||
require.NoError(t, stream.Send(&ExecRequest{Type: &ExecRequest_Command_{Command: &ExecRequest_Command{
|
||||
require.NoError(t, stream.Send(&v1.ExecRequest{Type: &v1.ExecRequest_Command_{Command: &v1.ExecRequest_Command{
|
||||
Name: execTestShell,
|
||||
Args: []string{"-c", `nohup sleep 30 >/dev/null 2>&1 </dev/null &
|
||||
echo "$!"
|
||||
|
||||
+43
-42
@@ -14,6 +14,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/cirruslabs/tart-guest-agent/pkg/v1"
|
||||
"github.com/stretchr/testify/require"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
@@ -27,22 +28,22 @@ type execTestStream struct {
|
||||
grpc.ServerStream
|
||||
|
||||
ctx context.Context
|
||||
requests chan *ExecRequest
|
||||
responses chan *ExecResponse
|
||||
sendHook func(*ExecResponse) error
|
||||
requests chan *v1.ExecRequest
|
||||
responses chan *v1.ExecResponse
|
||||
sendHook func(*v1.ExecResponse) error
|
||||
}
|
||||
|
||||
var _ grpc.BidiStreamingServer[ExecRequest, ExecResponse] = (*execTestStream)(nil)
|
||||
var _ grpc.BidiStreamingServer[v1.ExecRequest, v1.ExecResponse] = (*execTestStream)(nil)
|
||||
|
||||
func newExecTestStream(ctx context.Context) *execTestStream {
|
||||
return &execTestStream{
|
||||
ctx: ctx,
|
||||
requests: make(chan *ExecRequest, 8),
|
||||
responses: make(chan *ExecResponse, 8),
|
||||
requests: make(chan *v1.ExecRequest, 8),
|
||||
responses: make(chan *v1.ExecResponse, 8),
|
||||
}
|
||||
}
|
||||
|
||||
func (stream *execTestStream) Send(response *ExecResponse) error {
|
||||
func (stream *execTestStream) Send(response *v1.ExecResponse) error {
|
||||
if stream.sendHook != nil {
|
||||
if err := stream.sendHook(response); err != nil {
|
||||
return err
|
||||
@@ -57,7 +58,7 @@ func (stream *execTestStream) Send(response *ExecResponse) error {
|
||||
}
|
||||
}
|
||||
|
||||
func (stream *execTestStream) Recv() (*ExecRequest, error) {
|
||||
func (stream *execTestStream) Recv() (*v1.ExecRequest, error) {
|
||||
select {
|
||||
case request, ok := <-stream.requests:
|
||||
if !ok {
|
||||
@@ -72,7 +73,7 @@ func (stream *execTestStream) Recv() (*ExecRequest, error) {
|
||||
func (stream *execTestStream) Context() context.Context { return stream.ctx }
|
||||
|
||||
func TestExecSendsStartedBeforeOutputAndExit(t *testing.T) {
|
||||
_, stream, result := startExecTest(t, &ExecRequest_Command{
|
||||
_, stream, result := startExecTest(t, &v1.ExecRequest_Command{
|
||||
Name: execTestShell,
|
||||
Args: []string{"-c", "printf hello"},
|
||||
})
|
||||
@@ -84,9 +85,9 @@ func TestExecSendsStartedBeforeOutputAndExit(t *testing.T) {
|
||||
for {
|
||||
response := receiveExecResponse(t, stream)
|
||||
switch response := response.GetType().(type) {
|
||||
case *ExecResponse_StandardOutput:
|
||||
case *v1.ExecResponse_StandardOutput:
|
||||
output = append(output, response.StandardOutput.GetData()...)
|
||||
case *ExecResponse_Exit_:
|
||||
case *v1.ExecResponse_Exit_:
|
||||
require.EqualValues(t, 0, response.Exit.GetCode())
|
||||
require.Equal(t, []byte("hello"), output)
|
||||
require.NoError(t, receiveExecResult(t, result))
|
||||
@@ -98,15 +99,15 @@ func TestExecSendsStartedBeforeOutputAndExit(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExecClosesStandardInputOnRequestStreamEOF(t *testing.T) {
|
||||
_, stream, result := startExecTest(t, &ExecRequest_Command{
|
||||
_, stream, result := startExecTest(t, &v1.ExecRequest_Command{
|
||||
Name: "/bin/cat",
|
||||
Interactive: true,
|
||||
})
|
||||
require.NotNil(t, receiveExecResponse(t, stream).GetStarted())
|
||||
|
||||
stream.requests <- &ExecRequest{
|
||||
Type: &ExecRequest_StandardInput{
|
||||
StandardInput: &IOChunk{Data: []byte("hello")},
|
||||
stream.requests <- &v1.ExecRequest{
|
||||
Type: &v1.ExecRequest_StandardInput{
|
||||
StandardInput: &v1.IOChunk{Data: []byte("hello")},
|
||||
},
|
||||
}
|
||||
close(stream.requests)
|
||||
@@ -119,20 +120,20 @@ func TestExecClosesStandardInputOnRequestStreamEOF(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExecClosesStandardInputOnEmptyChunk(t *testing.T) {
|
||||
_, stream, result := startExecTest(t, &ExecRequest_Command{
|
||||
_, stream, result := startExecTest(t, &v1.ExecRequest_Command{
|
||||
Name: "/bin/cat",
|
||||
Interactive: true,
|
||||
})
|
||||
require.NotNil(t, receiveExecResponse(t, stream).GetStarted())
|
||||
|
||||
stream.requests <- &ExecRequest{
|
||||
Type: &ExecRequest_StandardInput{
|
||||
StandardInput: &IOChunk{Data: []byte("hello")},
|
||||
stream.requests <- &v1.ExecRequest{
|
||||
Type: &v1.ExecRequest_StandardInput{
|
||||
StandardInput: &v1.IOChunk{Data: []byte("hello")},
|
||||
},
|
||||
}
|
||||
stream.requests <- &ExecRequest{
|
||||
Type: &ExecRequest_StandardInput{
|
||||
StandardInput: &IOChunk{},
|
||||
stream.requests <- &v1.ExecRequest{
|
||||
Type: &v1.ExecRequest_StandardInput{
|
||||
StandardInput: &v1.IOChunk{},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -146,17 +147,17 @@ func TestExecClosesStandardInputOnEmptyChunk(t *testing.T) {
|
||||
func TestExecReportsStartFailureBeforeStarted(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
command *ExecRequest_Command
|
||||
command *v1.ExecRequest_Command
|
||||
}{
|
||||
{
|
||||
name: "missing executable",
|
||||
command: &ExecRequest_Command{
|
||||
command: &v1.ExecRequest_Command{
|
||||
Name: "/definitely/missing/tart-guest-agent-test-command",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "missing workdir",
|
||||
command: &ExecRequest_Command{
|
||||
command: &v1.ExecRequest_Command{
|
||||
Name: execTestShell,
|
||||
Workdir: "/definitely/missing/tart-guest-agent-test-workdir",
|
||||
},
|
||||
@@ -177,46 +178,46 @@ func TestExecReportsStartFailureBeforeStarted(t *testing.T) {
|
||||
func TestExecSignalsProcess(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
signal SignalRequest_Signal
|
||||
signal v1.SignalRequest_Signal
|
||||
code int32
|
||||
err string
|
||||
}{
|
||||
{
|
||||
name: "SIGTERM",
|
||||
signal: SignalRequest_SIGNAL_SIGTERM,
|
||||
signal: v1.SignalRequest_SIGNAL_SIGTERM,
|
||||
code: int32(signalExitCodeOffset + syscall.SIGTERM),
|
||||
},
|
||||
{
|
||||
name: "SIGKILL",
|
||||
signal: SignalRequest_SIGNAL_SIGKILL,
|
||||
signal: v1.SignalRequest_SIGNAL_SIGKILL,
|
||||
code: int32(signalExitCodeOffset + syscall.SIGKILL),
|
||||
},
|
||||
{
|
||||
name: "unsupported",
|
||||
signal: SignalRequest_SIGNAL_UNSPECIFIED,
|
||||
signal: v1.SignalRequest_SIGNAL_UNSPECIFIED,
|
||||
err: `unsupported exec signal "SIGNAL_UNSPECIFIED"`,
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
rpc, stream, result := startExecTest(t, &ExecRequest_Command{
|
||||
rpc, stream, result := startExecTest(t, &v1.ExecRequest_Command{
|
||||
Name: "/bin/sleep",
|
||||
Args: []string{"30"},
|
||||
})
|
||||
started := receiveExecResponse(t, stream).GetStarted()
|
||||
require.NotNil(t, started)
|
||||
|
||||
_, err := rpc.Signal(context.Background(), &SignalRequest{
|
||||
_, err := rpc.Signal(context.Background(), &v1.SignalRequest{
|
||||
ExecId: started.GetExecId(),
|
||||
Signal: test.signal,
|
||||
})
|
||||
|
||||
if test.err != "" {
|
||||
require.EqualError(t, err, test.err)
|
||||
_, err = rpc.Signal(context.Background(), &SignalRequest{
|
||||
_, err = rpc.Signal(context.Background(), &v1.SignalRequest{
|
||||
ExecId: started.GetExecId(),
|
||||
Signal: SignalRequest_SIGNAL_SIGKILL,
|
||||
Signal: v1.SignalRequest_SIGNAL_SIGKILL,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
receiveExecResponse(t, stream)
|
||||
@@ -235,7 +236,7 @@ func TestExecSignalsProcess(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExecSignalsProcessGroup(t *testing.T) {
|
||||
rpc, stream, result := startExecTest(t, &ExecRequest_Command{
|
||||
rpc, stream, result := startExecTest(t, &v1.ExecRequest_Command{
|
||||
Name: execTestShell,
|
||||
Args: []string{"-c", "sleep 30 & printf ready; wait"},
|
||||
})
|
||||
@@ -243,9 +244,9 @@ func TestExecSignalsProcessGroup(t *testing.T) {
|
||||
require.NotNil(t, started)
|
||||
require.Equal(t, []byte("ready"), receiveExecResponse(t, stream).GetStandardOutput().GetData())
|
||||
|
||||
_, err := rpc.Signal(context.Background(), &SignalRequest{
|
||||
_, err := rpc.Signal(context.Background(), &v1.SignalRequest{
|
||||
ExecId: started.GetExecId(),
|
||||
Signal: SignalRequest_SIGNAL_SIGTERM,
|
||||
Signal: v1.SignalRequest_SIGNAL_SIGTERM,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -259,12 +260,12 @@ func TestExecReapsProcessWhenStartedCannotBeSent(t *testing.T) {
|
||||
sendErr := errors.New("failed to send Started")
|
||||
var processPID int
|
||||
|
||||
_, _, result := startExecTest(t, &ExecRequest_Command{
|
||||
_, _, result := startExecTest(t, &v1.ExecRequest_Command{
|
||||
Name: execTestShell,
|
||||
Args: []string{"-c", `printf %d "$$" > "$PID_FILE"; exec sleep 30`},
|
||||
Env: map[string]string{"PID_FILE": pidPath},
|
||||
}, func(stream *execTestStream) {
|
||||
stream.sendHook = func(response *ExecResponse) error {
|
||||
stream.sendHook = func(response *v1.ExecResponse) error {
|
||||
if response.GetStarted() == nil {
|
||||
return nil
|
||||
}
|
||||
@@ -285,7 +286,7 @@ func TestExecReapsProcessWhenStartedCannotBeSent(t *testing.T) {
|
||||
|
||||
func startExecTest(
|
||||
t *testing.T,
|
||||
command *ExecRequest_Command,
|
||||
command *v1.ExecRequest_Command,
|
||||
configure ...func(*execTestStream),
|
||||
) (*RPC, *execTestStream, <-chan error) {
|
||||
t.Helper()
|
||||
@@ -302,13 +303,13 @@ func startExecTest(
|
||||
go func() {
|
||||
result <- rpc.Exec(stream)
|
||||
}()
|
||||
stream.requests <- &ExecRequest{
|
||||
Type: &ExecRequest_Command_{Command: command},
|
||||
stream.requests <- &v1.ExecRequest{
|
||||
Type: &v1.ExecRequest_Command_{Command: command},
|
||||
}
|
||||
return rpc, stream, result
|
||||
}
|
||||
|
||||
func receiveExecResponse(t *testing.T, stream *execTestStream) *ExecResponse {
|
||||
func receiveExecResponse(t *testing.T, stream *execTestStream) *v1.ExecResponse {
|
||||
t.Helper()
|
||||
|
||||
select {
|
||||
|
||||
@@ -4,9 +4,11 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net"
|
||||
|
||||
"github.com/cirruslabs/tart-guest-agent/pkg/v1"
|
||||
)
|
||||
|
||||
func (rpc *RPC) ResolveIP(ctx context.Context, _ *ResolveIPRequest) (*ResolveIPResponse, error) {
|
||||
func (rpc *RPC) ResolveIP(ctx context.Context, _ *v1.ResolveIPRequest) (*v1.ResolveIPResponse, error) {
|
||||
ifaceAddrs, err := net.InterfaceAddrs()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to retrieve VM's network interface addresses: %w", err)
|
||||
@@ -33,7 +35,7 @@ func (rpc *RPC) ResolveIP(ctx context.Context, _ *ResolveIPRequest) (*ResolveIPR
|
||||
continue
|
||||
}
|
||||
|
||||
return &ResolveIPResponse{
|
||||
return &v1.ResolveIPResponse{
|
||||
Ip: ipNet.IP.String(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
+4
-3
@@ -5,16 +5,17 @@ import (
|
||||
"net"
|
||||
"os"
|
||||
|
||||
"github.com/cirruslabs/tart-guest-agent/pkg/v1"
|
||||
"github.com/puzpuzpuz/xsync/v4"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
type RPC struct {
|
||||
v1.UnimplementedAgentServer
|
||||
|
||||
grpcServer *grpc.Server
|
||||
listener net.Listener
|
||||
execs *xsync.Map[string, *os.Process]
|
||||
|
||||
UnimplementedAgentServer
|
||||
}
|
||||
|
||||
func New(listener net.Listener) (*RPC, error) {
|
||||
@@ -24,7 +25,7 @@ func New(listener net.Listener) (*RPC, error) {
|
||||
execs: xsync.NewMap[string, *os.Process](),
|
||||
}
|
||||
|
||||
RegisterAgentServer(rpc.grpcServer, rpc)
|
||||
v1.RegisterAgentServer(rpc.grpcServer, rpc)
|
||||
|
||||
return rpc, nil
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.6
|
||||
// protoc v7.35.1
|
||||
// source: rpc/agent.proto
|
||||
// source: v1/agent.proto
|
||||
|
||||
package rpc
|
||||
package v1
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
@@ -55,11 +55,11 @@ func (x SignalRequest_Signal) String() string {
|
||||
}
|
||||
|
||||
func (SignalRequest_Signal) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_rpc_agent_proto_enumTypes[0].Descriptor()
|
||||
return file_v1_agent_proto_enumTypes[0].Descriptor()
|
||||
}
|
||||
|
||||
func (SignalRequest_Signal) Type() protoreflect.EnumType {
|
||||
return &file_rpc_agent_proto_enumTypes[0]
|
||||
return &file_v1_agent_proto_enumTypes[0]
|
||||
}
|
||||
|
||||
func (x SignalRequest_Signal) Number() protoreflect.EnumNumber {
|
||||
@@ -68,7 +68,7 @@ func (x SignalRequest_Signal) Number() protoreflect.EnumNumber {
|
||||
|
||||
// Deprecated: Use SignalRequest_Signal.Descriptor instead.
|
||||
func (SignalRequest_Signal) EnumDescriptor() ([]byte, []int) {
|
||||
return file_rpc_agent_proto_rawDescGZIP(), []int{6, 0}
|
||||
return file_v1_agent_proto_rawDescGZIP(), []int{6, 0}
|
||||
}
|
||||
|
||||
type ExecRequest struct {
|
||||
@@ -85,7 +85,7 @@ type ExecRequest struct {
|
||||
|
||||
func (x *ExecRequest) Reset() {
|
||||
*x = ExecRequest{}
|
||||
mi := &file_rpc_agent_proto_msgTypes[0]
|
||||
mi := &file_v1_agent_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -97,7 +97,7 @@ func (x *ExecRequest) String() string {
|
||||
func (*ExecRequest) ProtoMessage() {}
|
||||
|
||||
func (x *ExecRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_rpc_agent_proto_msgTypes[0]
|
||||
mi := &file_v1_agent_proto_msgTypes[0]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -110,7 +110,7 @@ func (x *ExecRequest) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use ExecRequest.ProtoReflect.Descriptor instead.
|
||||
func (*ExecRequest) Descriptor() ([]byte, []int) {
|
||||
return file_rpc_agent_proto_rawDescGZIP(), []int{0}
|
||||
return file_v1_agent_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *ExecRequest) GetType() isExecRequest_Type {
|
||||
@@ -184,7 +184,7 @@ type ExecResponse struct {
|
||||
|
||||
func (x *ExecResponse) Reset() {
|
||||
*x = ExecResponse{}
|
||||
mi := &file_rpc_agent_proto_msgTypes[1]
|
||||
mi := &file_v1_agent_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -196,7 +196,7 @@ func (x *ExecResponse) String() string {
|
||||
func (*ExecResponse) ProtoMessage() {}
|
||||
|
||||
func (x *ExecResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_rpc_agent_proto_msgTypes[1]
|
||||
mi := &file_v1_agent_proto_msgTypes[1]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -209,7 +209,7 @@ func (x *ExecResponse) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use ExecResponse.ProtoReflect.Descriptor instead.
|
||||
func (*ExecResponse) Descriptor() ([]byte, []int) {
|
||||
return file_rpc_agent_proto_rawDescGZIP(), []int{1}
|
||||
return file_v1_agent_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *ExecResponse) GetType() isExecResponse_Type {
|
||||
@@ -293,7 +293,7 @@ type TerminalSize struct {
|
||||
|
||||
func (x *TerminalSize) Reset() {
|
||||
*x = TerminalSize{}
|
||||
mi := &file_rpc_agent_proto_msgTypes[2]
|
||||
mi := &file_v1_agent_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -305,7 +305,7 @@ func (x *TerminalSize) String() string {
|
||||
func (*TerminalSize) ProtoMessage() {}
|
||||
|
||||
func (x *TerminalSize) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_rpc_agent_proto_msgTypes[2]
|
||||
mi := &file_v1_agent_proto_msgTypes[2]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -318,7 +318,7 @@ func (x *TerminalSize) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use TerminalSize.ProtoReflect.Descriptor instead.
|
||||
func (*TerminalSize) Descriptor() ([]byte, []int) {
|
||||
return file_rpc_agent_proto_rawDescGZIP(), []int{2}
|
||||
return file_v1_agent_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *TerminalSize) GetRows() uint32 {
|
||||
@@ -344,7 +344,7 @@ type IOChunk struct {
|
||||
|
||||
func (x *IOChunk) Reset() {
|
||||
*x = IOChunk{}
|
||||
mi := &file_rpc_agent_proto_msgTypes[3]
|
||||
mi := &file_v1_agent_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -356,7 +356,7 @@ func (x *IOChunk) String() string {
|
||||
func (*IOChunk) ProtoMessage() {}
|
||||
|
||||
func (x *IOChunk) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_rpc_agent_proto_msgTypes[3]
|
||||
mi := &file_v1_agent_proto_msgTypes[3]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -369,7 +369,7 @@ func (x *IOChunk) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use IOChunk.ProtoReflect.Descriptor instead.
|
||||
func (*IOChunk) Descriptor() ([]byte, []int) {
|
||||
return file_rpc_agent_proto_rawDescGZIP(), []int{3}
|
||||
return file_v1_agent_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *IOChunk) GetData() []byte {
|
||||
@@ -387,7 +387,7 @@ type ResolveIPRequest struct {
|
||||
|
||||
func (x *ResolveIPRequest) Reset() {
|
||||
*x = ResolveIPRequest{}
|
||||
mi := &file_rpc_agent_proto_msgTypes[4]
|
||||
mi := &file_v1_agent_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -399,7 +399,7 @@ func (x *ResolveIPRequest) String() string {
|
||||
func (*ResolveIPRequest) ProtoMessage() {}
|
||||
|
||||
func (x *ResolveIPRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_rpc_agent_proto_msgTypes[4]
|
||||
mi := &file_v1_agent_proto_msgTypes[4]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -412,7 +412,7 @@ func (x *ResolveIPRequest) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use ResolveIPRequest.ProtoReflect.Descriptor instead.
|
||||
func (*ResolveIPRequest) Descriptor() ([]byte, []int) {
|
||||
return file_rpc_agent_proto_rawDescGZIP(), []int{4}
|
||||
return file_v1_agent_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
type ResolveIPResponse struct {
|
||||
@@ -424,7 +424,7 @@ type ResolveIPResponse struct {
|
||||
|
||||
func (x *ResolveIPResponse) Reset() {
|
||||
*x = ResolveIPResponse{}
|
||||
mi := &file_rpc_agent_proto_msgTypes[5]
|
||||
mi := &file_v1_agent_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -436,7 +436,7 @@ func (x *ResolveIPResponse) String() string {
|
||||
func (*ResolveIPResponse) ProtoMessage() {}
|
||||
|
||||
func (x *ResolveIPResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_rpc_agent_proto_msgTypes[5]
|
||||
mi := &file_v1_agent_proto_msgTypes[5]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -449,7 +449,7 @@ func (x *ResolveIPResponse) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use ResolveIPResponse.ProtoReflect.Descriptor instead.
|
||||
func (*ResolveIPResponse) Descriptor() ([]byte, []int) {
|
||||
return file_rpc_agent_proto_rawDescGZIP(), []int{5}
|
||||
return file_v1_agent_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *ResolveIPResponse) GetIp() string {
|
||||
@@ -469,7 +469,7 @@ type SignalRequest struct {
|
||||
|
||||
func (x *SignalRequest) Reset() {
|
||||
*x = SignalRequest{}
|
||||
mi := &file_rpc_agent_proto_msgTypes[6]
|
||||
mi := &file_v1_agent_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -481,7 +481,7 @@ func (x *SignalRequest) String() string {
|
||||
func (*SignalRequest) ProtoMessage() {}
|
||||
|
||||
func (x *SignalRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_rpc_agent_proto_msgTypes[6]
|
||||
mi := &file_v1_agent_proto_msgTypes[6]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -494,7 +494,7 @@ func (x *SignalRequest) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use SignalRequest.ProtoReflect.Descriptor instead.
|
||||
func (*SignalRequest) Descriptor() ([]byte, []int) {
|
||||
return file_rpc_agent_proto_rawDescGZIP(), []int{6}
|
||||
return file_v1_agent_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (x *SignalRequest) GetExecId() string {
|
||||
@@ -528,7 +528,7 @@ type ExecRequest_Command struct {
|
||||
|
||||
func (x *ExecRequest_Command) Reset() {
|
||||
*x = ExecRequest_Command{}
|
||||
mi := &file_rpc_agent_proto_msgTypes[7]
|
||||
mi := &file_v1_agent_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -540,7 +540,7 @@ func (x *ExecRequest_Command) String() string {
|
||||
func (*ExecRequest_Command) ProtoMessage() {}
|
||||
|
||||
func (x *ExecRequest_Command) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_rpc_agent_proto_msgTypes[7]
|
||||
mi := &file_v1_agent_proto_msgTypes[7]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -553,7 +553,7 @@ func (x *ExecRequest_Command) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use ExecRequest_Command.ProtoReflect.Descriptor instead.
|
||||
func (*ExecRequest_Command) Descriptor() ([]byte, []int) {
|
||||
return file_rpc_agent_proto_rawDescGZIP(), []int{0, 0}
|
||||
return file_v1_agent_proto_rawDescGZIP(), []int{0, 0}
|
||||
}
|
||||
|
||||
func (x *ExecRequest_Command) GetName() string {
|
||||
@@ -628,7 +628,7 @@ type ExecResponse_Exit struct {
|
||||
|
||||
func (x *ExecResponse_Exit) Reset() {
|
||||
*x = ExecResponse_Exit{}
|
||||
mi := &file_rpc_agent_proto_msgTypes[9]
|
||||
mi := &file_v1_agent_proto_msgTypes[9]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -640,7 +640,7 @@ func (x *ExecResponse_Exit) String() string {
|
||||
func (*ExecResponse_Exit) ProtoMessage() {}
|
||||
|
||||
func (x *ExecResponse_Exit) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_rpc_agent_proto_msgTypes[9]
|
||||
mi := &file_v1_agent_proto_msgTypes[9]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -653,7 +653,7 @@ func (x *ExecResponse_Exit) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use ExecResponse_Exit.ProtoReflect.Descriptor instead.
|
||||
func (*ExecResponse_Exit) Descriptor() ([]byte, []int) {
|
||||
return file_rpc_agent_proto_rawDescGZIP(), []int{1, 0}
|
||||
return file_v1_agent_proto_rawDescGZIP(), []int{1, 0}
|
||||
}
|
||||
|
||||
func (x *ExecResponse_Exit) GetCode() int32 {
|
||||
@@ -672,7 +672,7 @@ type ExecResponse_Started struct {
|
||||
|
||||
func (x *ExecResponse_Started) Reset() {
|
||||
*x = ExecResponse_Started{}
|
||||
mi := &file_rpc_agent_proto_msgTypes[10]
|
||||
mi := &file_v1_agent_proto_msgTypes[10]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -684,7 +684,7 @@ func (x *ExecResponse_Started) String() string {
|
||||
func (*ExecResponse_Started) ProtoMessage() {}
|
||||
|
||||
func (x *ExecResponse_Started) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_rpc_agent_proto_msgTypes[10]
|
||||
mi := &file_v1_agent_proto_msgTypes[10]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -697,7 +697,7 @@ func (x *ExecResponse_Started) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use ExecResponse_Started.ProtoReflect.Descriptor instead.
|
||||
func (*ExecResponse_Started) Descriptor() ([]byte, []int) {
|
||||
return file_rpc_agent_proto_rawDescGZIP(), []int{1, 1}
|
||||
return file_v1_agent_proto_rawDescGZIP(), []int{1, 1}
|
||||
}
|
||||
|
||||
func (x *ExecResponse_Started) GetExecId() string {
|
||||
@@ -707,11 +707,11 @@ func (x *ExecResponse_Started) GetExecId() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_rpc_agent_proto protoreflect.FileDescriptor
|
||||
var File_v1_agent_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_rpc_agent_proto_rawDesc = "" +
|
||||
const file_v1_agent_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\x0frpc/agent.proto\x1a\x1bgoogle/protobuf/empty.proto\"\xff\x03\n" +
|
||||
"\x0ev1/agent.proto\x1a\x1bgoogle/protobuf/empty.proto\"\xff\x03\n" +
|
||||
"\vExecRequest\x120\n" +
|
||||
"\acommand\x18\x01 \x01(\v2\x14.ExecRequest.CommandH\x00R\acommand\x121\n" +
|
||||
"\x0estandard_input\x18\x02 \x01(\v2\b.IOChunkH\x00R\rstandardInput\x128\n" +
|
||||
@@ -758,23 +758,23 @@ const file_rpc_agent_proto_rawDesc = "" +
|
||||
"\x05Agent\x12'\n" +
|
||||
"\x04Exec\x12\f.ExecRequest\x1a\r.ExecResponse(\x010\x01\x120\n" +
|
||||
"\x06Signal\x12\x0e.SignalRequest\x1a\x16.google.protobuf.Empty\x122\n" +
|
||||
"\tResolveIP\x12\x11.ResolveIPRequest\x1a\x12.ResolveIPResponseB5Z3github.com/cirruslabs/tart-guest-agent/internal/rpcb\x06proto3"
|
||||
"\tResolveIP\x12\x11.ResolveIPRequest\x1a\x12.ResolveIPResponseB/Z-github.com/cirruslabs/tart-guest-agent/pkg/v1b\x06proto3"
|
||||
|
||||
var (
|
||||
file_rpc_agent_proto_rawDescOnce sync.Once
|
||||
file_rpc_agent_proto_rawDescData []byte
|
||||
file_v1_agent_proto_rawDescOnce sync.Once
|
||||
file_v1_agent_proto_rawDescData []byte
|
||||
)
|
||||
|
||||
func file_rpc_agent_proto_rawDescGZIP() []byte {
|
||||
file_rpc_agent_proto_rawDescOnce.Do(func() {
|
||||
file_rpc_agent_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_rpc_agent_proto_rawDesc), len(file_rpc_agent_proto_rawDesc)))
|
||||
func file_v1_agent_proto_rawDescGZIP() []byte {
|
||||
file_v1_agent_proto_rawDescOnce.Do(func() {
|
||||
file_v1_agent_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_v1_agent_proto_rawDesc), len(file_v1_agent_proto_rawDesc)))
|
||||
})
|
||||
return file_rpc_agent_proto_rawDescData
|
||||
return file_v1_agent_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_rpc_agent_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||
var file_rpc_agent_proto_msgTypes = make([]protoimpl.MessageInfo, 11)
|
||||
var file_rpc_agent_proto_goTypes = []any{
|
||||
var file_v1_agent_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||
var file_v1_agent_proto_msgTypes = make([]protoimpl.MessageInfo, 11)
|
||||
var file_v1_agent_proto_goTypes = []any{
|
||||
(SignalRequest_Signal)(0), // 0: SignalRequest.Signal
|
||||
(*ExecRequest)(nil), // 1: ExecRequest
|
||||
(*ExecResponse)(nil), // 2: ExecResponse
|
||||
@@ -789,7 +789,7 @@ var file_rpc_agent_proto_goTypes = []any{
|
||||
(*ExecResponse_Started)(nil), // 11: ExecResponse.Started
|
||||
(*emptypb.Empty)(nil), // 12: google.protobuf.Empty
|
||||
}
|
||||
var file_rpc_agent_proto_depIdxs = []int32{
|
||||
var file_v1_agent_proto_depIdxs = []int32{
|
||||
8, // 0: ExecRequest.command:type_name -> ExecRequest.Command
|
||||
4, // 1: ExecRequest.standard_input:type_name -> IOChunk
|
||||
3, // 2: ExecRequest.terminal_resize:type_name -> TerminalSize
|
||||
@@ -813,17 +813,17 @@ var file_rpc_agent_proto_depIdxs = []int32{
|
||||
0, // [0:10] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_rpc_agent_proto_init() }
|
||||
func file_rpc_agent_proto_init() {
|
||||
if File_rpc_agent_proto != nil {
|
||||
func init() { file_v1_agent_proto_init() }
|
||||
func file_v1_agent_proto_init() {
|
||||
if File_v1_agent_proto != nil {
|
||||
return
|
||||
}
|
||||
file_rpc_agent_proto_msgTypes[0].OneofWrappers = []any{
|
||||
file_v1_agent_proto_msgTypes[0].OneofWrappers = []any{
|
||||
(*ExecRequest_Command_)(nil),
|
||||
(*ExecRequest_StandardInput)(nil),
|
||||
(*ExecRequest_TerminalResize)(nil),
|
||||
}
|
||||
file_rpc_agent_proto_msgTypes[1].OneofWrappers = []any{
|
||||
file_v1_agent_proto_msgTypes[1].OneofWrappers = []any{
|
||||
(*ExecResponse_Exit_)(nil),
|
||||
(*ExecResponse_StandardOutput)(nil),
|
||||
(*ExecResponse_StandardError)(nil),
|
||||
@@ -833,18 +833,18 @@ func file_rpc_agent_proto_init() {
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_rpc_agent_proto_rawDesc), len(file_rpc_agent_proto_rawDesc)),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_v1_agent_proto_rawDesc), len(file_v1_agent_proto_rawDesc)),
|
||||
NumEnums: 1,
|
||||
NumMessages: 11,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_rpc_agent_proto_goTypes,
|
||||
DependencyIndexes: file_rpc_agent_proto_depIdxs,
|
||||
EnumInfos: file_rpc_agent_proto_enumTypes,
|
||||
MessageInfos: file_rpc_agent_proto_msgTypes,
|
||||
GoTypes: file_v1_agent_proto_goTypes,
|
||||
DependencyIndexes: file_v1_agent_proto_depIdxs,
|
||||
EnumInfos: file_v1_agent_proto_enumTypes,
|
||||
MessageInfos: file_v1_agent_proto_msgTypes,
|
||||
}.Build()
|
||||
File_rpc_agent_proto = out.File
|
||||
file_rpc_agent_proto_goTypes = nil
|
||||
file_rpc_agent_proto_depIdxs = nil
|
||||
File_v1_agent_proto = out.File
|
||||
file_v1_agent_proto_goTypes = nil
|
||||
file_v1_agent_proto_depIdxs = nil
|
||||
}
|
||||
@@ -2,9 +2,9 @@
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.5.1
|
||||
// - protoc v7.35.1
|
||||
// source: rpc/agent.proto
|
||||
// source: v1/agent.proto
|
||||
|
||||
package rpc
|
||||
package v1
|
||||
|
||||
import (
|
||||
context "context"
|
||||
@@ -189,5 +189,5 @@ var Agent_ServiceDesc = grpc.ServiceDesc{
|
||||
ClientStreams: true,
|
||||
},
|
||||
},
|
||||
Metadata: "rpc/agent.proto",
|
||||
Metadata: "v1/agent.proto",
|
||||
}
|
||||
@@ -2,7 +2,7 @@ syntax = "proto3";
|
||||
|
||||
import "google/protobuf/empty.proto";
|
||||
|
||||
option go_package = "github.com/cirruslabs/tart-guest-agent/internal/rpc";
|
||||
option go_package = "github.com/cirruslabs/tart-guest-agent/pkg/v1";
|
||||
|
||||
service Agent {
|
||||
rpc Exec(stream ExecRequest) returns (stream ExecResponse);
|
||||
Reference in New Issue
Block a user