Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
Ping hosts concurrently and find the fastest to you.
  • Loading branch information
youfou committed Jan 17, 2017
0 parents commit 74a8eb4
Show file tree
Hide file tree
Showing 7 changed files with 592 additions and 0 deletions.
97 changes: 97 additions & 0 deletions .gitignore
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_*

13 changes: 13 additions & 0 deletions LICENSE
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.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include README.md LICENSE
74 changes: 74 additions & 0 deletions README.md
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.
31 changes: 31 additions & 0 deletions mping/__init__.py
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'
Loading

0 comments on commit 74a8eb4

Please sign in to comment.