mirror of
https://github.com/daeuniverse/dae.git
synced 2024-12-22 20:44:41 +07:00
feat/optimize: print SubscriptionTag in AliveDialerSet::printLatencies() (#319)
This commit is contained in:
parent
371e0c19d1
commit
bfd4d99744
@ -135,7 +135,7 @@ func (a *AliveDialerSet) printLatencies() {
|
||||
return alive[i].l+alive[i].o < alive[j].l+alive[j].o
|
||||
})
|
||||
for i, dl := range alive {
|
||||
builder.WriteString(fmt.Sprintf("%4d. %v: %v\n", i+1, dl.d.property.Name, latencyString(dl.l, dl.o)))
|
||||
builder.WriteString(fmt.Sprintf("%4d. [%v] %v: %v\n", i+1, dl.d.property.SubscriptionTag, dl.d.property.Name, latencyString(dl.l, dl.o)))
|
||||
}
|
||||
a.log.Infoln(strings.TrimSuffix(builder.String(), "\n"))
|
||||
}
|
||||
|
@ -48,10 +48,11 @@ type InstanceOption struct {
|
||||
}
|
||||
|
||||
type Property struct {
|
||||
Name string
|
||||
Address string
|
||||
Protocol string
|
||||
Link string
|
||||
Name string
|
||||
Address string
|
||||
Protocol string
|
||||
Link string
|
||||
SubscriptionTag string
|
||||
}
|
||||
|
||||
type AliveDialerSetSet map[*AliveDialerSet]int
|
||||
|
@ -23,16 +23,17 @@ func FromLinkRegister(name string, creator FromLinkCreator) {
|
||||
fromLinkCreators[name] = creator
|
||||
}
|
||||
|
||||
func NewFromLink(gOption *GlobalOption, iOption InstanceOption, link string) (*Dialer, error) {
|
||||
func NewFromLink(gOption *GlobalOption, iOption InstanceOption, link string, subscriptionTag string) (*Dialer, error) {
|
||||
/// Get overwritten name.
|
||||
overwrittenName, linklike := common.GetTagFromLinkLikePlaintext(link)
|
||||
links := strings.Split(linklike, "->")
|
||||
d := direct.SymmetricDirect
|
||||
p := &Property{
|
||||
Name: "",
|
||||
Address: "",
|
||||
Protocol: "",
|
||||
Link: link,
|
||||
Name: "",
|
||||
Address: "",
|
||||
Protocol: "",
|
||||
Link: link,
|
||||
SubscriptionTag: subscriptionTag,
|
||||
}
|
||||
for i := len(links) - 1; i >= 0; i-- {
|
||||
link := strings.TrimSpace(links[i])
|
||||
|
@ -39,7 +39,7 @@ func NewDialerSetFromLinks(option *dialer.GlobalOption, tagToNodeList map[string
|
||||
}
|
||||
for subscriptionTag, nodes := range tagToNodeList {
|
||||
for _, node := range nodes {
|
||||
d, err := dialer.NewFromLink(option, dialer.InstanceOption{CheckEnabled: false}, node)
|
||||
d, err := dialer.NewFromLink(option, dialer.InstanceOption{CheckEnabled: false}, node, subscriptionTag)
|
||||
if err != nil {
|
||||
option.Log.Infof("failed to parse node: %v", err)
|
||||
continue
|
||||
|
Loading…
Reference in New Issue
Block a user