# Path: ss/utils.py
# PY2 = sys.version_info[0] == 2
# def compat_ord(s):
# def compat_chr(d):
# def to_bytes(s):
# def to_str(s):
# def inet_ntop(family, ipstr):
# def inet_pton(family, addr):
# def is_ip(address):
# def patch_socket():
# def pack_addr(address):
# def errno_from_exception(e):
# def get_sock_error(sock):
# def merge_prefix(deque, size):
# 
# Path: ss/settings.py
# class Settings(object):
#     DEFAULT_TIMEOUT = 300
#     _LOCK = RLock()
#     def __init__(self):
#     def __getitem__(self, name):
#     def __setitem__(self, name, val):
#     def get(self, name, default=None):
#     def __contains__(self, name):
#     def update(self, config):
#     def dict(self):
#     def __repr__(self):


import os
import time
import socket
import select
import errno
import logging
import threading
                    import traceback
from collections import defaultdict
from ss import utils
from ss.settings import settings

    def register(self, f, mode, handler):
        fd = f.fileno()
        self._fdmap[fd] = (f, handler)
        self._impl.register(fd, mode)

    def add(self, f, mode, handler):
        return self.register(f, mode, handler)

    def remove(self, f):
        fd = f.fileno()
        del self._fdmap[fd]
        self._impl.unregister(fd)

    def add_periodic(self, callback):
        self._periodic_callbacks.append(callback)

    def remove_periodic(self, callback):
        self._periodic_callbacks.remove(callback)

    def modify(self, f, mode):
        fd = f.fileno()
        self._impl.modify(fd, mode)

    def stop(self):
        self._stopping = True

    def run(self):
        self._stopping = False
        events = []

# Path: ss/utils.py
# PY2 = sys.version_info[0] == 2
# def compat_ord(s):
# def compat_chr(d):
# def to_bytes(s):
# def to_str(s):
# def inet_ntop(family, ipstr):
# def inet_pton(family, addr):
# def is_ip(address):
# def patch_socket():
# def pack_addr(address):
# def errno_from_exception(e):
# def get_sock_error(sock):
# def merge_prefix(deque, size):
# 
# Path: ss/settings.py
# class Settings(object):
#     DEFAULT_TIMEOUT = 300
#     _LOCK = RLock()
#     def __init__(self):
#     def __getitem__(self, name):
#     def __setitem__(self, name, val):
#     def get(self, name, default=None):
#     def __contains__(self, name):
#     def update(self, config):
#     def dict(self):
#     def __repr__(self):


# Path: ss/ioloop.py
import os
import time
import socket
import select
import errno
import logging
import threading
                    import traceback
from collections import defaultdict
from ss import utils
from ss.settings import settings


    def register(self, f, mode, handler):
        fd = f.fileno()
        self._fdmap[fd] = (f, handler)
        self._impl.register(fd, mode)

    def add(self, f, mode, handler):
        return self.register(f, mode, handler)

    def remove(self, f):
        fd = f.fileno()
        del self._fdmap[fd]
        self._impl.unregister(fd)

    def add_periodic(self, callback):
        self._periodic_callbacks.append(callback)

    def remove_periodic(self, callback):
        self._periodic_callbacks.remove(callback)

    def modify(self, f, mode):
        fd = f.fileno()
        self._impl.modify(fd, mode)

    def stop(self):
        self._stopping = True

    def run(self):
        self._stopping = False
        events = []

        while not self._stopping: