Skip to content

Commit

Permalink
Merge pull request #26 from thombashi/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
thombashi authored Jun 19, 2016
2 parents d7a38d6 + 8ddb3cb commit 4dbabc4
Show file tree
Hide file tree
Showing 26 changed files with 158 additions and 155 deletions.
22 changes: 16 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
language: python

env:
- TOXENV=py25
- TOXENV=py26
- TOXENV=py27
- TOXENV=py33
- TOXENV=py34
matrix:
include:
- python: 2.6
env: TOXENV=python2.6
- python: 2.7
env: TOXENV=python2.7
- python: 3.3
env: TOXENV=python3.3
- python: 3.4
env: TOXENV=python3.4
- python: 3.5
env: TOXENV=python3.5

os:
- linux
Expand All @@ -16,3 +22,7 @@ install:

script:
- tox

notifications:
slack:
secure: LqMd2Ddk+yY3pyRumasqMH3cpRrD0h5CvmhWHqT1PFFm9UA8bLpgf9gOfSN5n/BO60AD0Wr68fJOzvFbC5U4D4x7dcDHEPPWIDHBKPaO++tjITdcxbvOsiUySAc0VPm0JqMpiv/x2JLYiqhf9PRNJgnF8HdBrqmUioj6RZHabqpvkmq9HocmFCNeVOHPqQjBXMmo3eXuc5eRCJxG053f+sPDFwXHjYggMXFXasghPFAqWQRthPN4bqD0abTgUfIYxsgr2Gtx7e21Jp+lraPTcGWnXdco1d81WG+FMLFx6weLgTaw1Fp/T6bs5+fnC2e3bj92BrvSOM3NLLXvn2iOXW1R2nOfXlC10XQuz2UDIbUKdXxgF64F/Lpd2mlTrBgFCl4eLRaVgK1wdsIVvEf/stiXu4v5bIde2UTtimUeKUYbmX05FN5KVh7kQIdwBndJwkOXk+VWs4u1ynfw64upRbFihVBVqbarB8bjnwjVNDbpfF2xTTUjT4sZdPg2YCcBVVnrMbYGNIiDjPgWpLE0VB85dgFEADltkE0kZSbyn13d8kj8jS6+pZ+tNI6oACB0C0e5O+Sy+XozIQ4W5UhXJ2O424fAhNpO0aoqWAUHLTSSzEjiPib2LkJD9siD3GW7GM22rbFxMiIJ2eFCFclKzFxtaVj6czUH4yLk8VtAlNk=
42 changes: 20 additions & 22 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,25 @@ tcconfig
.. image:: https://travis-ci.org/thombashi/tcconfig.svg?branch=master
:target: https://travis-ci.org/thombashi/tcconfig


Summary
-------

``tcconfig`` is a Simple tc command wrapper.
Easy to set up traffic control of network bandwidth/latency/packet-loss to a network interface.


Traffic control features
------------------------

Network
~~~~~~~
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Traffic control can be specified network to apply to:

- Outgoing/Incoming packets
- Certain IP address/network and port

Available parameters
~~~~~~~~~~~~~~~~~~~~
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The following parameters can be set to network interfaces.

Expand All @@ -46,44 +44,44 @@ Set traffic control (``tcset`` command)
``tcset`` is a command to impose traffic control to a network interface (device).

e.g. Set a limit on bandwidth up to 100Kbps
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: console
.. code:: console
# tcset --device eth0 --rate 100k
e.g. Set 100ms network latency
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: console
.. code:: console
# tcset --device eth0 --delay 100
e.g. Set 0.1% packet loss
~~~~~~~~~~~~~~~~~~~~~~~~~
^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: console
.. code:: console
# tcset --device eth0 --loss 0.1
e.g. All of the above at once
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: console
.. code:: console
# tcset --device eth0 --rate 100k --delay 100 --loss 0.1
e.g. Specify the IP address of traffic control
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: console
.. code:: console
# tcset --device eth0 --delay 100 --network 192.168.0.10
e.g. Specify the IP network and port of traffic control
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: console
.. code:: console
# tcset --device eth0 --delay 100 --network 192.168.0.0/24 --port 80
Expand All @@ -94,9 +92,9 @@ Delete traffic control (``tcdel`` command)
interface (device).

e.g. Delete traffic control of eth0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: console
.. code:: console
# tcdel --device eth0
Expand All @@ -107,9 +105,9 @@ Display traffic control configurations (``tcshow`` command)
``tcshow`` is a command to display traffic control to network interface(s).

Example
~~~~~~~
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: console
.. code:: console
# tcset --device eth0 --delay 10 --delay-distro 2 --loss 0.01 --rate 0.25M --network 192.168.0.10 --port 8080
# tcset --device eth0 --delay 1 --loss 0.02 --rate 500K --direction incoming
Expand Down Expand Up @@ -137,10 +135,10 @@ Example
For more information
--------------------

More examples are available at
http://tcconfig.readthedocs.org/en/latest/pages/usage/index.html


Installation
============

Expand Down Expand Up @@ -176,7 +174,7 @@ Dependency python packages are automatically installed during
- `thutils <https://github.com/thombashi/thutils>`__

Test dependencies
~~~~~~~~~~~~~~~~~
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

- `pingparsing <https://github.com/thombashi/pingparsing>`__
- `pytest <http://pytest.org/latest/>`__
Expand Down
9 changes: 6 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys
import os
import pkg_resources
import sys

import sphinx_rtd_theme

Expand All @@ -36,6 +37,8 @@
'sphinx.ext.viewcode',
]

intersphinx_mapping = {'python': ('http://docs.python.org/', None)}

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

Expand All @@ -60,9 +63,9 @@
# built documents.
#
# The short X.Y version.
version = u'0.6.1'
version = pkg_resources.get_distribution("tcconfig").version
# The full version, including alpha/beta/rc tags.
release = u'0.6.1'
release = version

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Welcome to tcconfig's documentation!
:maxdepth: 3
:numbered:

pages/introduction
pages/introduction/index
pages/installation
pages/usage/index
pages/genindex
Expand Down
100 changes: 42 additions & 58 deletions docs/make_readme.py
Original file line number Diff line number Diff line change
@@ -1,86 +1,70 @@
#!/usr/bin/env python
# encoding: utf-8

"""
.. codeauthor:: Tsuyoshi Hombashi <[email protected]>
"""

import os
import os.path
import sys

import readmemaker

VERSION = "0.4.0"

PROJECT_NAME = "tcconfig"
OUTPUT_DIR = ".."
README_WORK_DIR = "."
DOC_PAGE_DIR = os.path.join(README_WORK_DIR, "pages")


def get_usage_file_path(filename):
return os.path.join(DOC_PAGE_DIR, "usage", filename)
def write_examples(maker):
maker.set_indent_level(0)
maker.write_chapter("Usage")

maker.inc_indent_level()
maker.write_chapter("Set traffic control (``tcset`` command)")
maker.write_example_file(os.path.join("tcset", "description.txt"))
maker.write_example_file(os.path.join("tcset", "basic_usage.rst"))

def write_line_list(f, line_list):
f.write("\n".join(line_list))
f.write("\n" * 2)
maker.write_example_file(os.path.join("tcdel", "header.rst"))
maker.write_example_file(os.path.join("tcdel", "usage.rst"))

maker.write_example_file(os.path.join("tcshow", "header.rst"))
maker.write_example_file(os.path.join("tcshow", "usage.rst"))

def write_usage_file(f, filename):
write_line_list(f, [
line.rstrip()
for line in
open(get_usage_file_path(filename)).readlines()
maker.write_chapter("For more information")
maker.write_line_list([
"More examples are available at ",
"http://%s.readthedocs.org/en/latest/pages/usage/index.html" % (
PROJECT_NAME),
])


def write_examples(f):
write_line_list(f, [
"Usage",
"=====",
])
def main():
maker = readmemaker.ReadmeMaker(PROJECT_NAME, OUTPUT_DIR)
maker.examples_dir_name = u"usage"

write_usage_file(f, os.path.join("tcset", "header.rst"))
write_line_list(f, [
line.rstrip().replace("^", "~")
for line in
open(get_usage_file_path(
os.path.join("tcset", "basic_usage.rst"))).readlines()
maker.write_introduction_file("badges.txt")

maker.inc_indent_level()
maker.write_chapter("Summary")
maker.write_introduction_file("summary.txt")
maker.write_introduction_file("feature.txt")
maker.write_line_list([
".. image:: docs/gif/tcset_example.gif",
])

write_usage_file(f, os.path.join("tcdel", "header.rst"))
write_usage_file(f, os.path.join("tcdel", "usage.rst"))
write_examples(maker)

write_usage_file(f, os.path.join("tcshow", "header.rst"))
write_usage_file(f, os.path.join("tcshow", "usage.rst"))
maker.write_file(
maker.doc_page_root_dir_path.joinpath("installation.rst"))

write_line_list(f, [
"For more information",
"--------------------",
"More examples are available at ",
"http://tcconfig.readthedocs.org/en/latest/pages/usage/index.html",
"",
maker.set_indent_level(0)
maker.write_chapter("Documentation")
maker.write_line_list([
"http://%s.readthedocs.org/en/latest/" % (PROJECT_NAME),
])

return 0

def main():
with open(os.path.join(OUTPUT_DIR, "README.rst"), "w") as f:
write_line_list(f, [
line.rstrip() for line in
open(os.path.join(DOC_PAGE_DIR, "introduction.rst")).readlines()
])
write_line_list(f, [
".. image:: docs/gif/tcset_example.gif",
])

write_examples(f)

write_line_list(f, [
line.rstrip() for line in
open(os.path.join(DOC_PAGE_DIR, "installation.rst")).readlines()
])

write_line_list(f, [
"Documentation",
"=============",
"",
"http://tcconfig.readthedocs.org/en/latest/"
])

if __name__ == '__main__':
sys.exit(main())
2 changes: 1 addition & 1 deletion docs/pages/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Dependency python packages are automatically installed during
- `thutils <https://github.com/thombashi/thutils>`__

Test dependencies
~~~~~~~~~~~~~~~~~
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

- `pingparsing <https://github.com/thombashi/pingparsing>`__
- `pytest <http://pytest.org/latest/>`__
Expand Down
36 changes: 0 additions & 36 deletions docs/pages/introduction.rst

This file was deleted.

4 changes: 4 additions & 0 deletions docs/pages/introduction/badges.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.. image:: https://img.shields.io/pypi/pyversions/tcconfig.svg
:target: https://pypi.python.org/pypi/tcconfig
.. image:: https://travis-ci.org/thombashi/tcconfig.svg?branch=master
:target: https://travis-ci.org/thombashi/tcconfig
Loading

0 comments on commit 4dbabc4

Please sign in to comment.