Skip to content

duguying/gomtr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gomtr Build Status

gomtr is a golang wrap for mtr-packet with born for solve concurrency mtr calling.

usage

package main

import (
	"fmt"
	"github.com/duguying/gomtr"
	"github.com/gogather/com/log"
	"time"
)

func main() {
	mtr := gomtr.NewMtrService("./mtr-packet")
	go mtr.Start()

	time.Sleep(time.Second * 10)

	iplist := []string{"183.131.7.130", "127.0.0.1", "114.215.151.25", "111.13.101.208"}

	for i := 0; i < len(iplist); i++ {
		mtr.Request(iplist[i], 10, func(response interface{}) {
			task := response.(*gomtr.MtrTask)
			log.Blueln("[ID]", i)
			fmt.Println(task.GetSummaryString())
		})
	}
}

license

MIT License

About

gomtr is a golang wrapper for mtr-packet

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages