github.com/Asutorufa/yuhaiin@v0.3.6-0.20240502055049-7984da7023a0/pkg/protos/node/latency/latency.go (about) 1 package latency 2 3 import ( 4 "github.com/Asutorufa/yuhaiin/pkg/net/latency" 5 "github.com/Asutorufa/yuhaiin/pkg/net/netapi" 6 durationpb "google.golang.org/protobuf/types/known/durationpb" 7 ) 8 9 func (l *Protocol_Http) Latency(p netapi.Proxy) (*durationpb.Duration, error) { 10 t, err := latency.HTTP(p, l.Http.GetUrl()) 11 return durationpb.New(t), err 12 } 13 14 func (l *Protocol_Dns) Latency(p netapi.Proxy) (*durationpb.Duration, error) { 15 t, err := latency.DNS(p, l.Dns.GetHost(), l.Dns.GetTargetDomain()) 16 return durationpb.New(t), err 17 } 18 19 func (l *Protocol_DnsOverQuic) Latency(p netapi.Proxy) (*durationpb.Duration, error) { 20 t, err := latency.DNSOverQuic(p, l.DnsOverQuic.Host, l.DnsOverQuic.TargetDomain) 21 return durationpb.New(t), err 22 }