server for clientside and serving to other nodes
This commit is contained in:
parent
c7c6ccc8eb
commit
611321aefb
24
serve.py
Normal file
24
serve.py
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
import socket
|
||||||
|
from BaseHTTPServer import HTTPServer
|
||||||
|
from SimpleHTTPServer import SimpleHTTPRequestHandler
|
||||||
|
|
||||||
|
class MyHandler(SimpleHTTPRequestHandler):
|
||||||
|
def do_GET(self):
|
||||||
|
if self.path == '/ip':
|
||||||
|
self.send_response(200)
|
||||||
|
self.send_header('Content-type', 'text/html')
|
||||||
|
self.end_headers()
|
||||||
|
self.wfile.write('Your IP address is %s' % self.client_address[0])
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
return SimpleHTTPRequestHandler.do_GET(self)
|
||||||
|
|
||||||
|
class HTTPServerV6(HTTPServer):
|
||||||
|
address_family = socket.AF_INET6
|
||||||
|
|
||||||
|
def main():
|
||||||
|
server = HTTPServerV6(('::', 13338), MyHandler)
|
||||||
|
server.serve_forever()
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
Loading…
Reference in New Issue
Block a user