-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ping hosts concurrently and find the fastest to you.
- Loading branch information
0 parents
commit 74a8eb4
Showing
7 changed files
with
592 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
env/ | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*,cover | ||
.hypothesis/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# IPython Notebook | ||
.ipynb_checkpoints | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# celery beat schedule file | ||
celerybeat-schedule | ||
|
||
# dotenv | ||
.env | ||
|
||
# virtualenv | ||
venv/ | ||
ENV/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# PyCharm | ||
.idea | ||
|
||
# Private | ||
data/ | ||
p_* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Copyright 2017 Youfou | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include README.md LICENSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# mping | ||
|
||
Ping hosts concurrently and find the fastest to you. | ||
|
||
## Installation | ||
|
||
pip3 install -U mping | ||
|
||
## Usages | ||
|
||
Just tell which host is the fastest: | ||
|
||
mping host1.com host2.com host3.com | ||
|
||
Get hosts from a file, and ping them: | ||
|
||
mping -p PATH/TO/THE/FILE.txt | ||
|
||
> Read **Input File** section below for more details. | ||
The results will be like this: | ||
|
||
host | count, loss%, min/avg/max | ||
-----------|-------------------------- | ||
shuame.com | 433, 0.0%, 5.4/6.8/14.1 | ||
qq.com | 90, 0.0%, 31.8/33.5/39.5 | ||
baidu.com | 77, 0.0%, 37.4/39.1/43.6 | ||
|
||
> The `count` number represents that how many pings returned to the each host. | ||
Also check out the help stuff for more instructions: | ||
|
||
mping -h | ||
|
||
## Input File | ||
|
||
You can use either a plain text file or a Json file as the `-p` / `--path` argument. | ||
|
||
|
||
**Plain Text File** | ||
|
||
When use a plain text file, just place each host in a line. | ||
|
||
For example: | ||
|
||
host1.com | ||
host2.com | ||
host3.com | ||
|
||
**Json File** | ||
|
||
You can also use a json file as the input hosts, and below is the 2 modes: | ||
|
||
Put hosts in a list: | ||
|
||
```json | ||
[ | ||
"host1.com", | ||
"host2.com", | ||
"host3.com" | ||
] | ||
``` | ||
|
||
Or in an object (dict) with names: | ||
|
||
```json | ||
{ | ||
"S1": "host1.com", | ||
"S2": "host3.com", | ||
"S3": "host3.com" | ||
} | ||
``` | ||
|
||
> The names will be printed in the results. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env python3 | ||
# coding: utf-8 | ||
|
||
""" | ||
mping | ||
~~~~~ | ||
Ping hosts concurrently and find the fastest to you. | ||
>>> results = mping() | ||
---- | ||
GitHub: https://github.com/youfou/mping | ||
---- | ||
:copyright: (c) 2017 by Youfou. | ||
:license: Apache 2.0, see LICENSE for more details. | ||
""" | ||
|
||
from .mping import mping, results_string | ||
|
||
__title__ = 'mping' | ||
__version__ = '0.1.0' | ||
__author__ = 'Youfou' | ||
__license__ = 'Apache 2.0' | ||
__copyright__ = 'Copyright 2017 Youfou' |
Oops, something went wrong.