AlaK4X
Linux lhjmq-records 5.15.0-118-generic #128-Ubuntu SMP Fri Jul 5 09:28:59 UTC 2024 x86_64



Your IP : 18.191.171.10


Current Path : /usr/lib/python3/dist-packages/twisted/words/
Upload File :
Current File : //usr/lib/python3/dist-packages/twisted/words/xmpproutertap.py

# -*- test-case-name: twisted.words.test.test_xmpproutertap -*-
#
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.

from twisted.application import strports
from twisted.python import usage
from twisted.words.protocols.jabber import component


class Options(usage.Options):
    optParameters = [
        ("port", None, "tcp:5347:interface=127.0.0.1", "Port components connect to"),
        ("secret", None, "secret", "Router secret"),
    ]

    optFlags = [
        ("verbose", "v", "Log traffic"),
    ]


def makeService(config):
    router = component.Router()
    factory = component.XMPPComponentServerFactory(router, config["secret"])

    if config["verbose"]:
        factory.logTraffic = True

    return strports.service(config["port"], factory)