| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- package tools
- type PingRequest struct {
- Target string `json:"target"`
- Count int `json:"count"` // 1 - 20, default 4
- Size int `json:"size"` // default 56
- Interface string `json:"interface"` // optional source interface
- Timeout int `json:"timeout"` // seconds, default 5
- DoNotFrag bool `json:"dont_frag"`
- }
- type PingReply struct {
- Seq int `json:"seq"`
- Bytes int `json:"bytes"`
- From string `json:"from"`
- TTL int `json:"ttl"`
- TimeMs float64 `json:"time_ms"`
- }
- type PingResponse struct {
- Target string `json:"target"`
- PacketsSent int `json:"packets_sent"`
- PacketsRecv int `json:"packets_recv"`
- PacketLossPct float64 `json:"packet_loss_pct"`
- MinRTT float64 `json:"min_rtt_ms"`
- AvgRTT float64 `json:"avg_rtt_ms"`
- MaxRTT float64 `json:"max_rtt_ms"`
- MdevRTT float64 `json:"mdev_rtt_ms"`
- Replies []PingReply `json:"replies"`
- RawOutput string `json:"raw_output"`
- Status string `json:"status"` // "ok", "partial", "timeout", "error"
- Error string `json:"error,omitempty"`
- }
- type PingStreamEvent struct {
- Type string `json:"type"` // "header", "reply", "timeout", "unreach", "stats", "done", "error"
- Seq int `json:"seq,omitempty"`
- Bytes int `json:"bytes,omitempty"`
- From string `json:"from,omitempty"`
- TTL int `json:"ttl,omitempty"`
- TimeMs float64 `json:"time_ms,omitempty"`
- PacketsSent int `json:"packets_sent,omitempty"`
- PacketsRecv int `json:"packets_recv,omitempty"`
- PacketLossPct float64 `json:"packet_loss_pct,omitempty"`
- MinRTT float64 `json:"min_rtt_ms,omitempty"`
- AvgRTT float64 `json:"avg_rtt_ms,omitempty"`
- MaxRTT float64 `json:"max_rtt_ms,omitempty"`
- MdevRTT float64 `json:"mdev_rtt_ms,omitempty"`
- Message string `json:"message,omitempty"`
- Raw string `json:"raw"`
- }
- type TracerouteRequest struct {
- Target string `json:"target"`
- MaxHops int `json:"max_hops"` // default 15, max 30
- Resolve bool `json:"resolve"` // DNS resolve IPs
- Interface string `json:"interface"` // source dev
- Protocol string `json:"protocol"` // "icmp", "udp"
- }
- type TracerouteHop struct {
- Hop int `json:"hop"`
- Host string `json:"host"`
- IP string `json:"ip"`
- TimesMs []string `json:"times_ms"`
- Status string `json:"status"` // "ok", "timeout"
- }
- type TracerouteResponse struct {
- Target string `json:"target"`
- Hops []TracerouteHop `json:"hops"`
- RawOutput string `json:"raw_output"`
- Error string `json:"error,omitempty"`
- }
- type TracerouteStreamEvent struct {
- Type string `json:"type"` // "header", "hop", "done", "error"
- Hop *TracerouteHop `json:"hop,omitempty"`
- HopsCount int `json:"hops_count,omitempty"`
- Message string `json:"message,omitempty"`
- Raw string `json:"raw"`
- }
- type DNSRequest struct {
- Domain string `json:"domain"`
- Type string `json:"type"` // A, AAAA, MX, TXT, NS, CNAME, ANY
- Server string `json:"server"` // optional DNS server IP
- }
- type DNSRecord struct {
- Name string `json:"name"`
- TTL int `json:"ttl"`
- Class string `json:"class"`
- Type string `json:"type"`
- Value string `json:"value"`
- }
- type DNSResponse struct {
- Domain string `json:"domain"`
- Type string `json:"type"`
- Server string `json:"server"`
- QueryTimeMs int `json:"query_time_ms"`
- Records []DNSRecord `json:"records"`
- RawOutput string `json:"raw_output"`
- Error string `json:"error,omitempty"`
- }
- type PortProbeRequest struct {
- Target string `json:"target"`
- Port int `json:"port"`
- Timeout int `json:"timeout"` // default 2s
- }
- type PortProbeResponse struct {
- Target string `json:"target"`
- Port int `json:"port"`
- Open bool `json:"open"`
- LatencyMs float64 `json:"latency_ms"`
- Service string `json:"service,omitempty"`
- RawOutput string `json:"raw_output"`
- Error string `json:"error,omitempty"`
- }
- type MTRRequest struct {
- Target string `json:"target"`
- Count int `json:"count"` // default 3
- }
- type MTRHop struct {
- Hop int `json:"hop"`
- Host string `json:"host"`
- LossPct float64 `json:"loss_pct"`
- Sent int `json:"sent"`
- LastMs float64 `json:"last_ms"`
- AvgMs float64 `json:"avg_ms"`
- BestMs float64 `json:"best_ms"`
- WrstMs float64 `json:"wrst_ms"`
- StDevMs float64 `json:"stdev_ms"`
- }
- type MTRResponse struct {
- Target string `json:"target"`
- Hops []MTRHop `json:"hops"`
- RawOutput string `json:"raw_output"`
- Error string `json:"error,omitempty"`
- }
|