()
| 36 | |
| 37 | |
| 38 | def main(): |
| 39 | argsGetter = ConfigurationGetter() |
| 40 | args = argsGetter.getConfiguration() |
| 41 | |
| 42 | factory = SyncFactory( |
| 43 | args.port, |
| 44 | args.password, |
| 45 | args.motd_file, |
| 46 | args.rooms_db_file, |
| 47 | args.permanent_rooms_file, |
| 48 | args.isolate_rooms, |
| 49 | args.salt, |
| 50 | args.disable_ready, |
| 51 | args.disable_chat, |
| 52 | args.max_chat_message_length, |
| 53 | args.max_username_length, |
| 54 | args.stats_db_file, |
| 55 | args.tls |
| 56 | ) |
| 57 | |
| 58 | if args.ipv6_only is True: |
| 59 | endpoint6 = TCP6ServerEndpoint(reactor, int(args.port), interface=args.interface_ipv6) |
| 60 | endpoint6.listen(factory).addCallbacks(isListening6, failed6) |
| 61 | elif args.ipv4_only is True: |
| 62 | endpoint4 = TCP4ServerEndpoint(reactor, int(args.port), interface=args.interface_ipv4) |
| 63 | endpoint4.listen(factory).addCallbacks(isListening4, failed4) |
| 64 | else: |
| 65 | endpoint6 = TCP6ServerEndpoint(reactor, int(args.port), interface=args.interface_ipv6) |
| 66 | endpoint6.listen(factory).addCallbacks(isListening6, failed6) |
| 67 | endpoint4 = TCP4ServerEndpoint(reactor, int(args.port), interface=args.interface_ipv4) |
| 68 | endpoint4.listen(factory).addCallbacks(isListening4, failed4) |
| 69 | |
| 70 | if ServerStatus.listening6 or ServerStatus.listening4: |
| 71 | reactor.run() |
| 72 | else: |
| 73 | print("Unable to listen using either IPv4 and IPv6 protocols. Quitting the server now.") |
| 74 | sys.exit() |
| 75 | |
| 76 | |
| 77 | if __name__ == "__main__": |
no test coverage detected