当前位置: 首页>>代码示例>>Python>>正文


Python DNS.login方法代码示例

本文整理汇总了Python中DNS.login方法的典型用法代码示例。如果您正苦于以下问题:Python DNS.login方法的具体用法?Python DNS.login怎么用?Python DNS.login使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DNS的用法示例。


在下文中一共展示了DNS.login方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __main

# 需要导入模块: import DNS [as 别名]
# 或者: from DNS import login [as 别名]
def __main():
    t0 = time.time()
    # Login to the peer tracker and get the current client IPs
    clients = DNS.login(TRACKER)

    node = nodeThread.node()
    node.start() #starts listening

    # Peer and relay with OR1
    messenger.sendPeerRequest(RELAYS[0])
    messenger.sendRelayRequest(RELAYS[0])
    # Relay with OR2 through OR1
    messenger.onionRouteMessage([RELAYS[0], RELAYS[1]], message.RELAY_SYN)
    # Relay with OR3 through OR1,OR2
    messenger.onionRouteMessage([RELAYS[0], RELAYS[1], RELAYS[2]], message.RELAY_SYN)
    # Register nickname with NP through OR1, OR2, OR3
    messenger.onionRouteMessage([RELAYS[0], RELAYS[1], RELAYS[2], RELAYS[3]], message.PROXY_SYN + NICK)
    time.sleep(3)
    
    while (TARGET not in clients):
        t1 = time.time()
        if (t1-t0) >= TIMEOUT:
            clients = DNS.login(TRACKER)
            t0 = t1 
    
    # Send Bob a message
    messenger.onionRouteMessage([RELAYS[0], RELAYS[1], RELAYS[2], TARGET_NICKNAME_PROXY], message.TO_NICK + TARGET_NICK + message.SEPARATOR + "Testing")
    time.sleep(TIMEOUT)
开发者ID:robertsmieja,项目名称:PyM,代码行数:30,代码来源:alice_client.py

示例2: __main

# 需要导入模块: import DNS [as 别名]
# 或者: from DNS import login [as 别名]
def __main():
    t0 = time.time()
    # Login to the peer tracker and get the current client IPs
    clients = DNS.login(TRACKER)

    node = nodeThread.node()
    node.start() #starts listening
    targetAddress = TARGET
    
    #Peer and relay with OR1
    messenger.sendPeerRequest(RELAYS[NUM_OF_RELAYS-1])
    messenger.sendRelayRequest(RELAYS[NUM_OF_RELAYS-1])
    
    # Relay with OR2 through OR1
    messenger.onionRouteMessage([RELAYS[NUM_OF_RELAYS-1], RELAYS[NUM_OF_RELAYS-2]], message.RELAY_SYN)
    # Relay with OR3 through OR1,OR2
    messenger.onionRouteMessage([RELAYS[NUM_OF_RELAYS-1], RELAYS[NUM_OF_RELAYS-2], RELAYS[NUM_OF_RELAYS-3]], message.RELAY_SYN)
    # Register nickname with NP through OR1, OR2, OR3
    messenger.onionRouteMessage([RELAYS[NUM_OF_RELAYS-1], RELAYS[NUM_OF_RELAYS-2], RELAYS[NUM_OF_RELAYS-3], RELAYS[NUM_OF_RELAYS-4]], message.PROXY_SYN + NICK)

    #Be logged in and keep nodeThread up
    while 1:
        t1 = time.time()
        if (t1-t0) >= TIMEOUT:
            clients = DNS.login(TRACKER)
            t0 = t1 
开发者ID:robertsmieja,项目名称:PyM,代码行数:28,代码来源:bob_client.py

示例3: __main

# 需要导入模块: import DNS [as 别名]
# 或者: from DNS import login [as 别名]
def __main():
    t0 = time.time()
    clients = DNS.login(TRACKER)
    
    #Be logged in
    while 1:
        t1 = time.time()
        if (t1-t0) >= TIMEOUT:
            clients = DNS.login(TRACKER)
            t0 = t1 
            
            for client in clients:
                if client not in PEERS:
                    PEERS.append(client)
                    messenger.sendPeerRequest(client)
开发者ID:robertsmieja,项目名称:PyM,代码行数:17,代码来源:login_client.py

示例4: __main

# 需要导入模块: import DNS [as 别名]
# 或者: from DNS import login [as 别名]
def __main():
	# Login to the peer tracker and get the current client IPs
	clients = DNS.login(TRACKER)
	# Pick an IP Address
	targetAddress = clients[0]
	# Testing operations (not what an actual client will eventually do)
	messenger.sendPeerRequest(targetAddress)
	messenger.sendRelayRequest(targetAddress)
	messenger.onionRouteMessage(targetAddress, targetAddress, targetAddress, targetAddress, message.PROXY_SYN + "Alice")
	time.sleep(3)
	messenger.onionRouteMessage(targetAddress, targetAddress, targetAddress, targetAddress, message.PROXY_SYN + "Bob")
	time.sleep(3)
	messenger.onionRouteMessage(targetAddress, targetAddress, targetAddress, targetAddress, message.TO_NICK + "Alice" + message.SEPARATOR + "Give Diretide")
开发者ID:robertsmieja,项目名称:PyM,代码行数:15,代码来源:client.py


注:本文中的DNS.login方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。