mirror of
https://github.com/openziti/zrok.git
synced 2024-11-26 01:54:09 +01:00
subordinate mode messaging improvements (#789)
This commit is contained in:
parent
35fc32b5f8
commit
94cfba746c
@ -47,13 +47,12 @@ func (i *agentGrpcImpl) AccessPrivate(_ context.Context, req *agentGrpc.AccessPr
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
go acc.monitor()
|
|
||||||
<-acc.bootComplete
|
<-acc.bootComplete
|
||||||
|
|
||||||
if acc.bootErr == nil {
|
if acc.bootErr == nil {
|
||||||
|
go acc.monitor()
|
||||||
i.agent.addAccess <- acc
|
i.agent.addAccess <- acc
|
||||||
return &agentGrpc.AccessPrivateResponse{FrontendToken: acc.frontendToken}, nil
|
return &agentGrpc.AccessPrivateResponse{FrontendToken: acc.frontendToken}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, acc.bootErr
|
return nil, acc.bootErr
|
||||||
}
|
}
|
||||||
|
@ -244,6 +244,7 @@ func (cmd *accessPrivateCommand) accessLocal(args []string, root env_core.Root)
|
|||||||
|
|
||||||
if cmd.subordinate {
|
if cmd.subordinate {
|
||||||
data := make(map[string]interface{})
|
data := make(map[string]interface{})
|
||||||
|
data["message"] = "boot"
|
||||||
data["frontend_token"] = accessResp.Payload.FrontendToken
|
data["frontend_token"] = accessResp.Payload.FrontendToken
|
||||||
data["bind_address"] = bindAddress
|
data["bind_address"] = bindAddress
|
||||||
jsonData, err := json.Marshal(data)
|
jsonData, err := json.Marshal(data)
|
||||||
@ -266,6 +267,7 @@ func (cmd *accessPrivateCommand) accessLocal(args []string, root env_core.Root)
|
|||||||
select {
|
select {
|
||||||
case req := <-requests:
|
case req := <-requests:
|
||||||
data := make(map[string]interface{})
|
data := make(map[string]interface{})
|
||||||
|
data["message"] = "access"
|
||||||
data["remote-address"] = req.RemoteAddr
|
data["remote-address"] = req.RemoteAddr
|
||||||
data["method"] = req.Method
|
data["method"] = req.Method
|
||||||
data["path"] = req.Path
|
data["path"] = req.Path
|
||||||
|
@ -47,6 +47,6 @@ func parseUrl(in string) (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func subordinateError(err error) {
|
func subordinateError(err error) {
|
||||||
fmt.Printf("{ \"error\": \"%v\" }\n", err.Error())
|
fmt.Printf("{ \"message\": \"error\", \"error\": \"%v\" }\n", err.Error())
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user