move utils to one utils.py file

This commit is contained in:
j 2014-05-18 00:18:32 +02:00
commit 53a9c296fb
6 changed files with 30 additions and 37 deletions

View file

@ -9,12 +9,11 @@ from tornado.httpserver import HTTPServer
import settings
import directory
import utils
import state
import user
import json
from ed25519_utils import valid
from utils import valid, get_public_ipv6
import api
import cert
@ -105,7 +104,7 @@ class ShareHandler(tornado.web.RequestHandler):
def publish_node():
host = utils.get_public_ipv6()
host = get_public_ipv6()
state.online = directory.put(settings.sk, {
'host': host,
'port': settings.server['node_port'],

View file

@ -1,13 +0,0 @@
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
import socket
def get_public_ipv6():
host = ('2a01:4f8:120:3201::3', 25519)
s = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)
s.connect(host)
ip = s.getsockname()[0]
s.close()
return ip