mirror of
https://github.com/openziti/zrok.git
synced 2025-06-21 02:07:44 +02:00
reworked 'tail' function for subordinate access (#789)
This commit is contained in:
parent
94cfba746c
commit
f5601e3a54
@ -46,8 +46,12 @@ func (a *access) tail(data []byte) {
|
|||||||
if line, err := a.readBuffer.ReadString('\n'); err == nil {
|
if line, err := a.readBuffer.ReadString('\n'); err == nil {
|
||||||
line = strings.Trim(line, "\n")
|
line = strings.Trim(line, "\n")
|
||||||
if !a.booted {
|
if !a.booted {
|
||||||
|
if strings.HasPrefix(line, "{") {
|
||||||
in := make(map[string]interface{})
|
in := make(map[string]interface{})
|
||||||
if err := json.Unmarshal([]byte(line), &in); err == nil {
|
if err := json.Unmarshal([]byte(line), &in); err == nil {
|
||||||
|
if v, found := in["message"]; found {
|
||||||
|
if str, ok := v.(string); ok {
|
||||||
|
if str == "boot" {
|
||||||
if v, found := in["frontend_token"]; found {
|
if v, found := in["frontend_token"]; found {
|
||||||
if str, ok := v.(string); ok {
|
if str, ok := v.(string); ok {
|
||||||
a.frontendToken = str
|
a.frontendToken = str
|
||||||
@ -59,11 +63,20 @@ func (a *access) tail(data []byte) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
a.booted = true
|
a.booted = true
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
a.bootErr = errors.New(line)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
logrus.Warn(line)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
a.bootErr = errors.New(line)
|
a.bootErr = errors.New(line)
|
||||||
}
|
}
|
||||||
close(a.bootComplete)
|
close(a.bootComplete)
|
||||||
|
} else {
|
||||||
|
logrus.Warn(line)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if strings.HasPrefix(line, "{") {
|
if strings.HasPrefix(line, "{") {
|
||||||
in := make(map[string]interface{})
|
in := make(map[string]interface{})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user