Skip to content

Commit 438de9f

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

File tree

11 files changed

+517
-78
lines changed

11 files changed

+517
-78
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.
@@ -22,9 +25,11 @@ mount_path ( R mountPath.
2225
protocol ( Rprotocol
2326
data ( Rdata
2427
guestAddr ( R guestAddr$
25-
udpTargetAddr ( RudpTargetAddr2�
28+
udpTargetAddr ( RudpTargetAddr2�
2629
GuestService(
2730
GetInfo.google.protobuf.Empty.Info-
2831
GetEvents.google.protobuf.Empty.Event01
2932
PostInotify.Inotify.google.protobuf.Empty(,
30-
Tunnel.TunnelMessage.TunnelMessage(0B!Zgithub.com/lima-vm/lima/pkg/apibproto3
33+
Tunnel.TunnelMessage.TunnelMessage(01
34+
GetIPv4.google.protobuf.Empty.CommandOutput1
35+
GetIPv6.google.protobuf.Empty.CommandOutputB!Zgithub.com/lima-vm/lima/pkg/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
@@ -10,6 +10,8 @@ service GuestService {
1010
rpc PostInotify(stream Inotify) returns (google.protobuf.Empty);
1111

1212
rpc Tunnel(stream TunnelMessage) returns (stream TunnelMessage);
13+
rpc GetIPv4(google.protobuf.Empty) returns (CommandOutput);
14+
rpc GetIPv6(google.protobuf.Empty) returns (CommandOutput);
1315
}
1416

1517
message Info {
@@ -29,6 +31,11 @@ message IPPort {
2931
int32 port = 3;
3032
}
3133

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

0 commit comments

Comments
 (0)