wired in console endpoint into agent, wired into 'zrok agent console' (#221)

This commit is contained in:
Michael Quigley 2024-10-04 16:06:30 -04:00
parent b0178a0619
commit d3568c061d
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62
12 changed files with 124 additions and 62 deletions

View File

@ -18,6 +18,7 @@ import (
)
type Agent struct {
cfg *AgentConfig
root env_core.Root
agentSocket string
shares map[string]*share
@ -28,11 +29,12 @@ type Agent struct {
rmAccess chan *access
}
func NewAgent(root env_core.Root) (*Agent, error) {
func NewAgent(cfg *AgentConfig, root env_core.Root) (*Agent, error) {
if !root.IsEnabled() {
return nil, errors.Errorf("unable to load environment; did you 'zrok enable'?")
}
return &Agent{
cfg: cfg,
root: root,
shares: make(map[string]*share),
addShare: make(chan *share),
@ -61,7 +63,7 @@ func (a *Agent) Run() error {
a.agentSocket = agentSocket
go a.manager()
go a.gateway()
go a.gateway(a.cfg)
srv := grpc.NewServer()
agentGrpc.RegisterAgentServer(srv, &agentGrpcImpl{agent: a})
@ -88,7 +90,11 @@ func (a *Agent) Shutdown() {
}
}
func (a *Agent) gateway() {
func (a *Agent) Config() *AgentConfig {
return a.cfg
}
func (a *Agent) gateway(cfg *AgentConfig) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
@ -100,7 +106,7 @@ func (a *Agent) gateway() {
logrus.Fatalf("unable to register gateway: %v", err)
}
if err := http.ListenAndServe(":8888", agentUi.Middleware(mux)); err != nil {
if err := http.ListenAndServe(cfg.ConsoleEndpoint, agentUi.Middleware(mux)); err != nil {
logrus.Error(err)
}
}

View File

@ -1053,7 +1053,8 @@ type VersionResponse struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
V string `protobuf:"bytes,1,opt,name=v,proto3" json:"v,omitempty"`
V string `protobuf:"bytes,1,opt,name=v,proto3" json:"v,omitempty"`
ConsoleEndpoint string `protobuf:"bytes,2,opt,name=consoleEndpoint,proto3" json:"consoleEndpoint,omitempty"`
}
func (x *VersionResponse) Reset() {
@ -1095,6 +1096,13 @@ func (x *VersionResponse) GetV() string {
return ""
}
func (x *VersionResponse) GetConsoleEndpoint() string {
if x != nil {
return x.ConsoleEndpoint
}
return ""
}
var File_agent_agentGrpc_agent_proto protoreflect.FileDescriptor
var file_agent_agentGrpc_agent_proto_rawDesc = []byte{
@ -1220,45 +1228,48 @@ var file_agent_agentGrpc_agent_proto_rawDesc = []byte{
0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x44,
0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, 0x22, 0x10, 0x0a,
0x0e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22,
0x1f, 0x0a, 0x0f, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x49, 0x0a, 0x0f, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x12, 0x0c, 0x0a, 0x01, 0x76, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x76,
0x32, 0x95, 0x04, 0x0a, 0x05, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x12, 0x40, 0x0a, 0x0d, 0x41, 0x63,
0x63, 0x65, 0x73, 0x73, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x12, 0x15, 0x2e, 0x41, 0x63,
0x63, 0x65, 0x73, 0x73, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x16, 0x2e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x50, 0x72, 0x69, 0x76, 0x61,
0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x40, 0x0a, 0x0d,
0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x15, 0x2e,
0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x41, 0x63,
0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3d,
0x0a, 0x0c, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, 0x14,
0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68,
0x61, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x40, 0x0a,
0x0d, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x12, 0x15,
0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x73,
0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12,
0x3d, 0x0a, 0x0c, 0x53, 0x68, 0x61, 0x72, 0x65, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x12,
0x14, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x50, 0x72, 0x69,
0x76, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3a,
0x0a, 0x0b, 0x53, 0x68, 0x61, 0x72, 0x65, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x12, 0x13, 0x2e,
0x53, 0x68, 0x61, 0x72, 0x65, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x14, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x06, 0x53, 0x74,
0x61, 0x74, 0x75, 0x73, 0x12, 0x0e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x18, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x12, 0x10, 0x2f,
0x76, 0x31, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12,
0x47, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x0f, 0x2e, 0x56, 0x65, 0x72,
0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x56, 0x65,
0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x19, 0x82,
0xd3, 0xe4, 0x93, 0x02, 0x13, 0x12, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74,
0x2f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68,
0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x7a, 0x69, 0x74, 0x69, 0x2f,
0x7a, 0x72, 0x6f, 0x6b, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74,
0x47, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x12, 0x28, 0x0a, 0x0f, 0x63, 0x6f, 0x6e, 0x73, 0x6f, 0x6c, 0x65, 0x45, 0x6e, 0x64, 0x70, 0x6f,
0x69, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x63, 0x6f, 0x6e, 0x73, 0x6f,
0x6c, 0x65, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x32, 0x95, 0x04, 0x0a, 0x05, 0x41,
0x67, 0x65, 0x6e, 0x74, 0x12, 0x40, 0x0a, 0x0d, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x50, 0x72,
0x69, 0x76, 0x61, 0x74, 0x65, 0x12, 0x15, 0x2e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x50, 0x72,
0x69, 0x76, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x41,
0x63, 0x63, 0x65, 0x73, 0x73, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x40, 0x0a, 0x0d, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73,
0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x15, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73,
0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16,
0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x0c, 0x52, 0x65, 0x6c, 0x65,
0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, 0x14, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61,
0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15,
0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x40, 0x0a, 0x0d, 0x53, 0x68, 0x61, 0x72, 0x65,
0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x12, 0x15, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65,
0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
0x16, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x0c, 0x53, 0x68, 0x61,
0x72, 0x65, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x12, 0x14, 0x2e, 0x53, 0x68, 0x61, 0x72,
0x65, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
0x15, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0b, 0x53, 0x68, 0x61, 0x72,
0x65, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x12, 0x13, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x50,
0x75, 0x62, 0x6c, 0x69, 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x53,
0x68, 0x61, 0x72, 0x65, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0e,
0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f,
0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22,
0x18, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x12, 0x10, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x67, 0x65,
0x6e, 0x74, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x47, 0x0a, 0x07, 0x56, 0x65, 0x72,
0x73, 0x69, 0x6f, 0x6e, 0x12, 0x0f, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x12,
0x11, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x76, 0x65, 0x72, 0x73, 0x69,
0x6f, 0x6e, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d,
0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x7a, 0x69, 0x74, 0x69, 0x2f, 0x7a, 0x72, 0x6f, 0x6b, 0x2f, 0x61,
0x67, 0x65, 0x6e, 0x74, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x70, 0x63, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (

View File

@ -122,4 +122,5 @@ message VersionRequest {
message VersionResponse {
string v = 1;
string consoleEndpoint = 2;
}

View File

@ -197,6 +197,9 @@
"properties": {
"v": {
"type": "string"
},
"consoleEndpoint": {
"type": "string"
}
}
},

View File

@ -1,6 +1,5 @@
.babelrc
.gitignore
.openapi-generator-ignore
.travis.yml
README.md
docs/AccessDetail.md
@ -30,14 +29,3 @@ src/model/SharePublicResponse.js
src/model/ShareReservedResponse.js
src/model/StatusResponse.js
src/model/VersionResponse.js
test/api/AgentApi.spec.js
test/model/AccessDetail.spec.js
test/model/AccessPrivateResponse.spec.js
test/model/ProtobufAny.spec.js
test/model/RpcStatus.spec.js
test/model/ShareDetail.spec.js
test/model/SharePrivateResponse.spec.js
test/model/SharePublicResponse.spec.js
test/model/ShareReservedResponse.spec.js
test/model/StatusResponse.spec.js
test/model/VersionResponse.spec.js

View File

@ -5,5 +5,6 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**v** | **String** | | [optional]
**consoleEndpoint** | **String** | | [optional]

View File

@ -50,6 +50,9 @@ class VersionResponse {
if (data.hasOwnProperty('v')) {
obj['v'] = ApiClient.convertToType(data['v'], 'String');
}
if (data.hasOwnProperty('consoleEndpoint')) {
obj['consoleEndpoint'] = ApiClient.convertToType(data['consoleEndpoint'], 'String');
}
}
return obj;
}
@ -64,6 +67,10 @@ class VersionResponse {
if (data['v'] && !(typeof data['v'] === 'string' || data['v'] instanceof String)) {
throw new Error("Expected the field `v` to be a primitive type in the JSON string but got " + data['v']);
}
// ensure the json data is a string
if (data['consoleEndpoint'] && !(typeof data['consoleEndpoint'] === 'string' || data['consoleEndpoint'] instanceof String)) {
throw new Error("Expected the field `consoleEndpoint` to be a primitive type in the JSON string but got " + data['consoleEndpoint']);
}
return true;
}
@ -78,6 +85,11 @@ class VersionResponse {
*/
VersionResponse.prototype['v'] = undefined;
/**
* @member {String} consoleEndpoint
*/
VersionResponse.prototype['consoleEndpoint'] = undefined;

11
agent/config.go Normal file
View File

@ -0,0 +1,11 @@
package agent
type AgentConfig struct {
ConsoleEndpoint string
}
func DefaultAgentConfig() *AgentConfig {
return &AgentConfig{
ConsoleEndpoint: "127.0.0.1:8888",
}
}

View File

@ -10,5 +10,8 @@ import (
func (i *agentGrpcImpl) Version(_ context.Context, _ *agentGrpc.VersionRequest) (*agentGrpc.VersionResponse, error) {
v := build.String()
logrus.Debugf("responding to version inquiry with '%v'", v)
return &agentGrpc.VersionResponse{V: v}, nil
return &agentGrpc.VersionResponse{
V: v,
ConsoleEndpoint: i.agent.Config().ConsoleEndpoint,
}, nil
}

View File

@ -1,6 +1,11 @@
package main
import (
"context"
"fmt"
"github.com/openziti/zrok/agent/agentClient"
"github.com/openziti/zrok/agent/agentGrpc"
"github.com/openziti/zrok/environment"
"github.com/openziti/zrok/tui"
"github.com/spf13/cobra"
)
@ -25,7 +30,23 @@ func newAgentConsoleCommand() *agentConsoleCommand {
}
func (cmd *agentConsoleCommand) run(_ *cobra.Command, _ []string) {
if err := openBrowser("http://localhost:8888"); err != nil {
tui.Error("unable to open agent console at 'http://localhost:8888'", err)
root, err := environment.LoadRoot()
if err != nil {
tui.Error("error loading zrokdir", err)
}
client, conn, err := agentClient.NewClient(root)
if err != nil {
tui.Error("error connecting to agent", err)
}
defer func() { _ = conn.Close() }()
v, err := client.Version(context.Background(), &agentGrpc.VersionRequest{})
if err != nil {
tui.Error("error getting agent version", err)
}
if err := openBrowser("http://" + v.ConsoleEndpoint); err != nil {
tui.Error(fmt.Sprintf("unable to open agent console at 'http://%v'", v.ConsoleEndpoint), err)
}
}

View File

@ -15,7 +15,8 @@ func init() {
}
type agentStartCommand struct {
cmd *cobra.Command
cmd *cobra.Command
consoleEndpoint string
}
func newAgentStartCommand() *agentStartCommand {
@ -26,6 +27,7 @@ func newAgentStartCommand() *agentStartCommand {
}
command := &agentStartCommand{cmd: cmd}
cmd.Run = command.run
cmd.Flags().StringVar(&command.consoleEndpoint, "console-endpoint", "127.0.0.1:8888", "gRPC gateway endpoint")
return command
}
@ -39,7 +41,9 @@ func (cmd *agentStartCommand) run(_ *cobra.Command, _ []string) {
tui.Error("unable to load environment; did you 'zrok enable'?", nil)
}
a, err := agent.NewAgent(root)
cfg := agent.DefaultAgentConfig()
cfg.ConsoleEndpoint = cmd.consoleEndpoint
a, err := agent.NewAgent(cfg, root)
if err != nil {
tui.Error("error creating agent", err)
}

View File

@ -2,6 +2,7 @@ package main
import (
"context"
"fmt"
"github.com/openziti/zrok/agent/agentClient"
"github.com/openziti/zrok/agent/agentGrpc"
"github.com/openziti/zrok/environment"
@ -38,12 +39,12 @@ func (cmd *agentVersionCommand) run(_ *cobra.Command, _ []string) {
if err != nil {
tui.Error("error connecting to agent", err)
}
defer conn.Close()
defer func() { _ = conn.Close() }()
v, err := client.Version(context.Background(), &agentGrpc.VersionRequest{})
if err != nil {
tui.Error("error getting agent version", err)
}
println(v.GetV())
fmt.Printf("%v\n%v\n", v.GetV(), v.GetConsoleEndpoint())
}