Skip to content

Commit 1c9a442

Browse files
committed
Support get IPs for both guestagent and plain mode
Signed-off-by: Songpon Srisawai <[email protected]>
1 parent 7a6078c commit 1c9a442

File tree

11 files changed

+516
-77
lines changed

11 files changed

+516
-77
lines changed

pkg/guestagent/api/client/client.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,11 @@ func (c *GuestAgentClient) Tunnel(ctx context.Context) (api.GuestService_TunnelC
7676
}
7777
return stream, nil
7878
}
79+
80+
func (c *GuestAgentClient) IPv4(ctx context.Context) (*api.CommandOutput, error) {
81+
return c.cli.GetIPv4(ctx, &emptypb.Empty{})
82+
}
83+
84+
func (c *GuestAgentClient) IPv6(ctx context.Context) (*api.CommandOutput, error) {
85+
return c.cli.GetIPv6(ctx, &emptypb.Empty{})
86+
}

pkg/guestagent/api/guestservice.pb.desc

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-

2+

33
guestservice.protogoogle/protobuf/empty.protogoogle/protobuf/timestamp.proto"0
44
Info(
55
local_ports ( 2.IPPortR
@@ -12,7 +12,10 @@ localPorts"
1212
IPPort
1313
protocol ( Rprotocol
1414
ip ( Rip
15-
port (Rport"X
15+
port (Rport"B
16+
CommandOutput
17+
is_json (RisJson
18+
payload ( Rpayload"X
1619
Inotify
1720

1821
mount_path ( R mountPath.
@@ -23,9 +26,11 @@ mount_path ( R mountPath.
2326
data ( Rdata
2427

2528
guest_addr ( R guestAddr&
26-
udp_target_addr ( RudpTargetAddr2�
29+
udp_target_addr ( RudpTargetAddr2�
2730
GuestService(
2831
GetInfo.google.protobuf.Empty.Info-
2932
GetEvents.google.protobuf.Empty.Event01
3033
PostInotify.Inotify.google.protobuf.Empty(,
31-
Tunnel.TunnelMessage.TunnelMessage(0B/Z-github.com/lima-vm/lima/v2/pkg/guestagent/apibproto3
34+
Tunnel.TunnelMessage.TunnelMessage(01
35+
GetIPv4.google.protobuf.Empty.CommandOutput1
36+
GetIPv6.google.protobuf.Empty.CommandOutputB/Z-github.com/lima-vm/lima/v2/pkg/guestagent/apibproto3

pkg/guestagent/api/guestservice.pb.go

Lines changed: 145 additions & 63 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/guestagent/api/guestservice.proto

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ service GuestService {
1111
rpc PostInotify(stream Inotify) returns (google.protobuf.Empty);
1212

1313
rpc Tunnel(stream TunnelMessage) returns (stream TunnelMessage);
14+
rpc GetIPv4(google.protobuf.Empty) returns (CommandOutput);
15+
rpc GetIPv6(google.protobuf.Empty) returns (CommandOutput);
1416
}
1517

1618
message Info {
@@ -30,6 +32,11 @@ message IPPort {
3032
int32 port = 3;
3133
}
3234

35+
message CommandOutput {
36+
bool is_json = 1;
37+
bytes payload = 2;
38+
}
39+
3340
message Inotify {
3441
string mount_path = 1;
3542
google.protobuf.Timestamp time = 2;

0 commit comments

Comments
 (0)