|
915 | 915 | </schedule> |
916 | 916 | </integrity> |
917 | 917 |
|
| 918 | + <!-- ═══════════════════════════════════════════════════════════════════════════ |
| 919 | + PORT SCHEDULE & ACCESS CONTROL |
| 920 | + ═══════════════════════════════════════════════════════════════════════════ |
| 921 | + Controls when ports are open (accepting connections) and when they close. |
| 922 | + Default: open 24/7/365. Admin can restrict by: |
| 923 | + - Days of the week (Mon-Sun) |
| 924 | + - Hours of the day (00:00-23:59) |
| 925 | + - Months of the year (Jan-Dec) |
| 926 | + - City Mayor override (remote XML/JSON endpoint) |
| 927 | +
|
| 928 | + Ports automatically OPEN when NWE/modules start and CLOSE when they stop. |
| 929 | + This schedule layer adds time-based restrictions ON TOP of runtime state. |
| 930 | +
|
| 931 | + A city Mayor can send XML or JSON to the mayor-endpoint to dynamically |
| 932 | + control port hours and theme colors for their jurisdiction. |
| 933 | + ═══════════════════════════════════════════════════════════════════════════ --> |
| 934 | + <port-schedule> |
| 935 | + <!-- Master switch: enable/disable schedule enforcement --> |
| 936 | + <enabled>true</enabled> |
| 937 | + |
| 938 | + <!-- Default policy: OPEN means ports are open unless schedule says otherwise --> |
| 939 | + <default-policy>OPEN</default-policy> |
| 940 | + |
| 941 | + <!-- Default schedule: 24/7 (all days, all hours, all months) --> |
| 942 | + <default-hours>00:00-23:59</default-hours> |
| 943 | + <default-days>Mon,Tue,Wed,Thu,Fri,Sat,Sun</default-days> |
| 944 | + <default-months>Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec</default-months> |
| 945 | + |
| 946 | + <!-- Timezone for schedule evaluation --> |
| 947 | + <timezone>America/New_York</timezone> |
| 948 | + |
| 949 | + <!-- ── Per-Module Schedule Overrides ─────────────────────────────────── --> |
| 950 | + <module-schedules> |
| 951 | + <!-- Example: Defined™ restricted to business hours --> |
| 952 | + <module id="Defined" port="49220"> |
| 953 | + <hours>06:00-23:00</hours> |
| 954 | + <days>Mon,Tue,Wed,Thu,Fri</days> |
| 955 | + <months>Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec</months> |
| 956 | + <weekend-hours>08:00-20:00</weekend-hours> |
| 957 | + </module> |
| 958 | + |
| 959 | + <!-- All other modules: 24/7 default (no override needed) --> |
| 960 | + <module id="SpectrumTandem" port="49222"> |
| 961 | + <hours>00:00-23:59</hours> |
| 962 | + <days>Mon,Tue,Wed,Thu,Fri,Sat,Sun</days> |
| 963 | + </module> |
| 964 | + <module id="Communicator" port="49230"> |
| 965 | + <hours>00:00-23:59</hours> |
| 966 | + <days>Mon,Tue,Wed,Thu,Fri,Sat,Sun</days> |
| 967 | + </module> |
| 968 | + <module id="UNCW" port="49231"> |
| 969 | + <hours>00:00-23:59</hours> |
| 970 | + <days>Mon,Tue,Wed,Thu,Fri,Sat,Sun</days> |
| 971 | + </module> |
| 972 | + <module id="Strernary" port="20000"> |
| 973 | + <hours>00:00-23:59</hours> |
| 974 | + <days>Mon,Tue,Wed,Thu,Fri,Sat,Sun</days> |
| 975 | + </module> |
| 976 | + <module id="CaliforniaFBI" port="49210"> |
| 977 | + <hours>00:00-23:59</hours> |
| 978 | + <days>Mon,Tue,Wed,Thu,Fri,Sat,Sun</days> |
| 979 | + </module> |
| 980 | + <module id="CaliforniaCIA" port="49211"> |
| 981 | + <hours>00:00-23:59</hours> |
| 982 | + <days>Mon,Tue,Wed,Thu,Fri,Sat,Sun</days> |
| 983 | + </module> |
| 984 | + <module id="CaliforniaNSA" port="49212"> |
| 985 | + <hours>00:00-23:59</hours> |
| 986 | + <days>Mon,Tue,Wed,Thu,Fri,Sat,Sun</days> |
| 987 | + </module> |
| 988 | + <module id="DukeUniversity" port="49213"> |
| 989 | + <hours>00:00-23:59</hours> |
| 990 | + <days>Mon,Tue,Wed,Thu,Fri,Sat,Sun</days> |
| 991 | + </module> |
| 992 | + <module id="StanfordLibrary" port="49214"> |
| 993 | + <hours>00:00-23:59</hours> |
| 994 | + <days>Mon,Tue,Wed,Thu,Fri,Sat,Sun</days> |
| 995 | + </module> |
| 996 | + <module id="Vietnam" port="49215"> |
| 997 | + <hours>00:00-23:59</hours> |
| 998 | + <days>Mon,Tue,Wed,Thu,Fri,Sat,Sun</days> |
| 999 | + </module> |
| 1000 | + <module id="Emeter" port="49216"> |
| 1001 | + <hours>00:00-23:59</hours> |
| 1002 | + <days>Mon,Tue,Wed,Thu,Fri,Sat,Sun</days> |
| 1003 | + </module> |
| 1004 | + <module id="Futures" port="5000"> |
| 1005 | + <hours>00:00-23:59</hours> |
| 1006 | + <days>Mon,Tue,Wed,Thu,Fri,Sat,Sun</days> |
| 1007 | + </module> |
| 1008 | + <module id="GrayPortRegistry" port="9999"> |
| 1009 | + <hours>00:00-23:59</hours> |
| 1010 | + <days>Mon,Tue,Wed,Thu,Fri,Sat,Sun</days> |
| 1011 | + </module> |
| 1012 | + <module id="Gray85Creme" port="10085"> |
| 1013 | + <hours>00:00-23:59</hours> |
| 1014 | + <days>Mon,Tue,Wed,Thu,Fri,Sat,Sun</days> |
| 1015 | + </module> |
| 1016 | + </module-schedules> |
| 1017 | + |
| 1018 | + <!-- ── Auto Open/Close Behavior ──────────────────────────────────────── --> |
| 1019 | + <auto-manage> |
| 1020 | + <!-- When NWE starts: open ports in UFW/iptables for scheduled modules --> |
| 1021 | + <open-on-start>true</open-on-start> |
| 1022 | + <!-- When NWE stops: close all NWE ports in firewall --> |
| 1023 | + <close-on-stop>true</close-on-stop> |
| 1024 | + <!-- When a module goes offline mid-schedule: close its port --> |
| 1025 | + <close-on-module-stop>true</close-on-module-stop> |
| 1026 | + <!-- Firewall command (auto-detected: ufw, firewall-cmd, or iptables) --> |
| 1027 | + <firewall>auto</firewall> |
| 1028 | + </auto-manage> |
| 1029 | + |
| 1030 | + <!-- ── City Mayor Remote Override ─────────────────────────────────────── |
| 1031 | + A city Mayor's website can send XML or JSON to this endpoint to |
| 1032 | + control port hours and theme colors for their jurisdiction. |
| 1033 | + |
| 1034 | + The server polls the mayor-endpoint every poll-interval-minutes. |
| 1035 | + If the mayor's server responds with valid XML/JSON, those settings |
| 1036 | + override the default schedule for the specified ports. |
| 1037 | + |
| 1038 | + Mayor can control: |
| 1039 | + - Which ports are open/closed |
| 1040 | + - Operating hours per port |
| 1041 | + - Theme colors for the web frontend |
| 1042 | + - Custom message/banner |
| 1043 | + ──────────────────────────────────────────────────────────────────────── --> |
| 1044 | + <mayor-override> |
| 1045 | + <enabled>false</enabled> |
| 1046 | + <poll-interval-minutes>60</poll-interval-minutes> |
| 1047 | + <timeout-ms>10000</timeout-ms> |
| 1048 | + <max-response-size-kb>64</max-response-size-kb> |
| 1049 | + |
| 1050 | + <!-- Registered mayor endpoints (admin adds these) --> |
| 1051 | + <mayors> |
| 1052 | + <!-- Example: Durham NC Mayor --> |
| 1053 | + <mayor id="durham-nc"> |
| 1054 | + <city>Durham</city> |
| 1055 | + <state>NC</state> |
| 1056 | + <endpoint>https://durhamnc.gov/api/nwe-port-schedule</endpoint> |
| 1057 | + <format>json</format> |
| 1058 | + <auth-header>X-NWE-Mayor-Token</auth-header> |
| 1059 | + <trusted>true</trusted> |
| 1060 | + <description>City of Durham, NC — Mayor's office port schedule override</description> |
| 1061 | + </mayor> |
| 1062 | + |
| 1063 | + <!-- Example: Wilmington NC Mayor (for UNCW module) --> |
| 1064 | + <mayor id="wilmington-nc"> |
| 1065 | + <city>Wilmington</city> |
| 1066 | + <state>NC</state> |
| 1067 | + <endpoint>https://wilmingtonnc.gov/api/nwe-port-schedule</endpoint> |
| 1068 | + <format>xml</format> |
| 1069 | + <auth-header>X-NWE-Mayor-Token</auth-header> |
| 1070 | + <trusted>true</trusted> |
| 1071 | + <description>City of Wilmington, NC — Mayor's office (UNCW jurisdiction)</description> |
| 1072 | + </mayor> |
| 1073 | + </mayors> |
| 1074 | + |
| 1075 | + <!-- Expected response format (JSON) --> |
| 1076 | + <response-schema-json><![CDATA[ |
| 1077 | +{ |
| 1078 | + "mayor_id": "durham-nc", |
| 1079 | + "city": "Durham", |
| 1080 | + "effective_date": "2026-07-16", |
| 1081 | + "expires": "2026-08-16", |
| 1082 | + "ports": { |
| 1083 | + "49222": { "hours": "06:00-22:00", "days": "Mon,Tue,Wed,Thu,Fri,Sat", "status": "open" }, |
| 1084 | + "49230": { "hours": "00:00-23:59", "days": "Mon,Tue,Wed,Thu,Fri,Sat,Sun", "status": "open" }, |
| 1085 | + "49231": { "hours": "08:00-20:00", "days": "Mon,Tue,Wed,Thu,Fri", "status": "open" } |
| 1086 | + }, |
| 1087 | + "theme_override": { |
| 1088 | + "accent_color": "#1e40af", |
| 1089 | + "banner": "City of Durham — Open Service Hours" |
| 1090 | + } |
| 1091 | +} |
| 1092 | + ]]></response-schema-json> |
| 1093 | + |
| 1094 | + <!-- Expected response format (XML) --> |
| 1095 | + <response-schema-xml><![CDATA[ |
| 1096 | +<mayor-schedule mayor-id="wilmington-nc" city="Wilmington" effective="2026-07-16" expires="2026-08-16"> |
| 1097 | + <port id="49231" hours="08:00-22:00" days="Mon,Tue,Wed,Thu,Fri,Sat" status="open"/> |
| 1098 | + <port id="49230" hours="00:00-23:59" days="Mon,Tue,Wed,Thu,Fri,Sat,Sun" status="open"/> |
| 1099 | + <theme accent-color="#00727A" banner="City of Wilmington — Seahawk Hours"/> |
| 1100 | +</mayor-schedule> |
| 1101 | + ]]></response-schema-xml> |
| 1102 | + </mayor-override> |
| 1103 | + |
| 1104 | + <!-- ── Admin Commands for Schedule Management ─────────────────────────── --> |
| 1105 | + <admin-commands> |
| 1106 | + <command>SCHEDULE_SET|port|hours|days|months</command> |
| 1107 | + <command>SCHEDULE_GET|port</command> |
| 1108 | + <command>SCHEDULE_RESET|port</command> |
| 1109 | + <command>SCHEDULE_MAYOR_ADD|id|city|state|endpoint|format</command> |
| 1110 | + <command>SCHEDULE_MAYOR_REMOVE|id</command> |
| 1111 | + <command>SCHEDULE_MAYOR_POLL</command> |
| 1112 | + <command>SCHEDULE_STATUS</command> |
| 1113 | + </admin-commands> |
| 1114 | + </port-schedule> |
| 1115 | + |
918 | 1116 | </nwe-config> |
0 commit comments