mirror of
https://github.com/openziti/zrok.git
synced 2025-06-13 13:26:46 +02:00
refactored 'share.tail' for new subordinate boot protocol (#789)
This commit is contained in:
parent
f4fa04e687
commit
85a22950a7
@ -63,12 +63,14 @@ func (a *access) tail(data []byte) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
a.booted = true
|
a.booted = true
|
||||||
|
} else {
|
||||||
|
a.bootErr = errors.New(line)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
a.bootErr = errors.New(line)
|
a.bootErr = errors.New(line)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logrus.Warn(line)
|
a.bootErr = errors.New(line)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
a.bootErr = errors.New(line)
|
a.bootErr = errors.New(line)
|
||||||
|
@ -54,8 +54,12 @@ func (s *share) tail(data []byte) {
|
|||||||
if line, err := s.readBuffer.ReadString('\n'); err == nil {
|
if line, err := s.readBuffer.ReadString('\n'); err == nil {
|
||||||
line = strings.Trim(line, "\n")
|
line = strings.Trim(line, "\n")
|
||||||
if !s.booted {
|
if !s.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["token"]; found {
|
if v, found := in["token"]; found {
|
||||||
if str, ok := v.(string); ok {
|
if str, ok := v.(string); ok {
|
||||||
s.token = str
|
s.token = str
|
||||||
@ -89,8 +93,19 @@ func (s *share) tail(data []byte) {
|
|||||||
} else {
|
} else {
|
||||||
s.bootErr = errors.New(line)
|
s.bootErr = errors.New(line)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
s.bootErr = errors.New(line)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
s.bootErr = errors.New(line)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
s.bootErr = errors.New(line)
|
||||||
|
}
|
||||||
close(s.bootComplete)
|
close(s.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