mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-29 16:58:34 +00:00
Add observatory / latestPing balancing strategy
Co-authored-by: Shelikhoo <xiaokangwang@outlook.com>
This commit is contained in:
parent
77d0419aca
commit
5c366db847
21 changed files with 1127 additions and 31 deletions
26
app/observatory/explainErrors.go
Normal file
26
app/observatory/explainErrors.go
Normal file
|
@ -0,0 +1,26 @@
|
|||
package observatory
|
||||
|
||||
import "github.com/xtls/xray-core/common/errors"
|
||||
|
||||
type errorCollector struct {
|
||||
errors *errors.Error
|
||||
}
|
||||
|
||||
func (e *errorCollector) SubmitError(err error) {
|
||||
if e.errors == nil {
|
||||
e.errors = newError("underlying connection error").Base(err)
|
||||
return
|
||||
}
|
||||
e.errors = e.errors.Base(newError("underlying connection error").Base(err))
|
||||
}
|
||||
|
||||
func newErrorCollector() *errorCollector {
|
||||
return &errorCollector{}
|
||||
}
|
||||
|
||||
func (e *errorCollector) UnderlyingError() error {
|
||||
if e.errors == nil {
|
||||
return newError("failed to produce report")
|
||||
}
|
||||
return e.errors
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue