mirror of
https://github.com/openziti/zrok.git
synced 2024-11-22 08:03:49 +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
|
||||
}
|
||||
|
||||
go acc.monitor()
|
||||
<-acc.bootComplete
|
||||
|
||||
if acc.bootErr == nil {
|
||||
go acc.monitor()
|
||||
i.agent.addAccess <- acc
|
||||
return &agentGrpc.AccessPrivateResponse{FrontendToken: acc.frontendToken}, nil
|
||||
}
|
||||
|
||||
return nil, acc.bootErr
|
||||
}
|
||||
|
@ -244,6 +244,7 @@ func (cmd *accessPrivateCommand) accessLocal(args []string, root env_core.Root)
|
||||
|
||||
if cmd.subordinate {
|
||||
data := make(map[string]interface{})
|
||||
data["message"] = "boot"
|
||||
data["frontend_token"] = accessResp.Payload.FrontendToken
|
||||
data["bind_address"] = bindAddress
|
||||
jsonData, err := json.Marshal(data)
|
||||
@ -266,6 +267,7 @@ func (cmd *accessPrivateCommand) accessLocal(args []string, root env_core.Root)
|
||||
select {
|
||||
case req := <-requests:
|
||||
data := make(map[string]interface{})
|
||||
data["message"] = "access"
|
||||
data["remote-address"] = req.RemoteAddr
|
||||
data["method"] = req.Method
|
||||
data["path"] = req.Path
|
||||
|
@ -47,6 +47,6 @@ func parseUrl(in string) (string, error) {
|
||||
}
|
||||
|
||||
func subordinateError(err error) {
|
||||
fmt.Printf("{ \"error\": \"%v\" }\n", err.Error())
|
||||
fmt.Printf("{ \"message\": \"error\", \"error\": \"%v\" }\n", err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user