Attempt to load configuration from a module my_ipsc_config.py to allow leaving your systems configured without editing the main Python source file - and as that file is expected to have IPs / keys that may not be intended for the public, tell git to ignore that file.
This commit is contained in:
parent
1253c7f405
commit
3413dee576
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,5 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
.dropbox
|
.dropbox
|
||||||
Icon
|
Icon
|
||||||
|
my_ipsc_config.py
|
||||||
|
*.pyc
|
||||||
|
151
ipsc.py
151
ipsc.py
@ -62,84 +62,87 @@ logger = logging.getLogger('ipsc')
|
|||||||
|
|
||||||
|
|
||||||
# Data structure for holding IPSC information
|
# Data structure for holding IPSC information
|
||||||
NETWORK = {
|
try:
|
||||||
'IPSC1': {
|
from my_ipsc_config import NETWORK
|
||||||
'LOCAL': {
|
except ImportError:
|
||||||
'DESCRIPTION': 'IPSC Network #1',
|
NETWORK = {
|
||||||
'MODE': b'\x6A',
|
'IPSC1': {
|
||||||
'FLAGS': b'\x00\x00\x80\xDC',
|
'LOCAL': {
|
||||||
'PORT': 50001,
|
'DESCRIPTION': 'IPSC Network #1',
|
||||||
'RADIO_ID': binascii.unhexlify('00000001'),
|
'MODE': b'\x6A',
|
||||||
'AUTH_KEY': binascii.unhexlify('0000000000000000000000000000000000000001')
|
'FLAGS': b'\x00\x00\x80\xDC',
|
||||||
|
'PORT': 50001,
|
||||||
|
'RADIO_ID': binascii.unhexlify('00000001'),
|
||||||
|
'AUTH_KEY': binascii.unhexlify('0000000000000000000000000000000000000001')
|
||||||
|
},
|
||||||
|
'MASTER': {
|
||||||
|
'IP': '1.1.1.1',
|
||||||
|
'MODE': b'\x6A',
|
||||||
|
'PORT': 50000,
|
||||||
|
'RADIO_ID': '',
|
||||||
|
},
|
||||||
|
'PEERS': [ # each list entry will be a dictionary for IP, RADIO ID and PORT
|
||||||
|
#{'IP': '100.200.1.1', 'PORT': 50000, 'RADIO_ID': b'\x00\x00\x00\xFF'},
|
||||||
|
]
|
||||||
},
|
},
|
||||||
'MASTER': {
|
'IPSC2': {
|
||||||
'IP': '1.1.1.1',
|
'LOCAL': {
|
||||||
'MODE': b'\x6A',
|
'DESCRIPTION': 'IPSC Network #1',
|
||||||
'PORT': 50000,
|
'MODE': b'\x6A',
|
||||||
'RADIO_ID': '',
|
'FLAGS': b'\x00\x00\x80\xDC',
|
||||||
|
'PORT': 50002,
|
||||||
|
'RADIO_ID': binascii.unhexlify('00000002'),
|
||||||
|
'AUTH_KEY': binascii.unhexlify('0000000000000000000000000000000000000022')
|
||||||
|
},
|
||||||
|
'MASTER': {
|
||||||
|
'IP': '2.2.2.2',
|
||||||
|
'MODE': b'\x6A',
|
||||||
|
'PORT': 50000,
|
||||||
|
'RADIO_ID': '',
|
||||||
|
},
|
||||||
|
'PEERS': [ # each list entry will be a dictionary for IP, RADIO ID and PORT
|
||||||
|
#{'IP': '100.200.1.1', 'PORT': 50000, 'RADIO_ID': b'\x00\x00\x00\xFF'},
|
||||||
|
]
|
||||||
},
|
},
|
||||||
'PEERS': [ # each list entry will be a dictionary for IP, RADIO ID and PORT
|
'IPSC3': {
|
||||||
#{'IP': '100.200.1.1', 'PORT': 50000, 'RADIO_ID': b'\x00\x00\x00\xFF'},
|
'LOCAL': {
|
||||||
]
|
'DESCRIPTION': 'IPSC Network #1',
|
||||||
},
|
'MODE': b'\x6A',
|
||||||
'IPSC2': {
|
'FLAGS': b'\x00\x00\x80\xDC',
|
||||||
'LOCAL': {
|
'PORT': 50003,
|
||||||
'DESCRIPTION': 'IPSC Network #1',
|
'RADIO_ID': binascii.unhexlify('00000003'),
|
||||||
'MODE': b'\x6A',
|
'AUTH_KEY': binascii.unhexlify('0000000000000000000000000000000000000333')
|
||||||
'FLAGS': b'\x00\x00\x80\xDC',
|
},
|
||||||
'PORT': 50002,
|
'MASTER': {
|
||||||
'RADIO_ID': binascii.unhexlify('00000002'),
|
'IP': '3.3.3.3',
|
||||||
'AUTH_KEY': binascii.unhexlify('0000000000000000000000000000000000000022')
|
'MODE': b'\x6A',
|
||||||
|
'PORT': 50000,
|
||||||
|
'RADIO_ID': '',
|
||||||
|
},
|
||||||
|
'PEERS': [ # each list entry will be a dictionary for IP, RADIO ID and PORT
|
||||||
|
#{'IP': '100.200.1.1', 'PORT': 50000, 'RADIO_ID': b'\x00\x00\x00\xFF'},
|
||||||
|
]
|
||||||
},
|
},
|
||||||
'MASTER': {
|
'IPSC4': {
|
||||||
'IP': '2.2.2.2',
|
'LOCAL': {
|
||||||
'MODE': b'\x6A',
|
'DESCRIPTION': 'IPSC Network #1',
|
||||||
'PORT': 50000,
|
'MODE': b'\x6A',
|
||||||
'RADIO_ID': '',
|
'FLAGS': b'\x00\x00\x80\xDC',
|
||||||
},
|
'PORT': 50004,
|
||||||
'PEERS': [ # each list entry will be a dictionary for IP, RADIO ID and PORT
|
'RADIO_ID': binascii.unhexlify('00000004'),
|
||||||
#{'IP': '100.200.1.1', 'PORT': 50000, 'RADIO_ID': b'\x00\x00\x00\xFF'},
|
'AUTH_KEY': binascii.unhexlify('0000000000000000000000000000000000004444')
|
||||||
]
|
},
|
||||||
},
|
'MASTER': {
|
||||||
'IPSC3': {
|
'IP': '4.4.4.4',
|
||||||
'LOCAL': {
|
'MODE': b'\x6A',
|
||||||
'DESCRIPTION': 'IPSC Network #1',
|
'PORT': 50000,
|
||||||
'MODE': b'\x6A',
|
'RADIO_ID': '',
|
||||||
'FLAGS': b'\x00\x00\x80\xDC',
|
},
|
||||||
'PORT': 50003,
|
'PEERS': [ # each list entry will be a dictionary for IP, RADIO ID and PORT
|
||||||
'RADIO_ID': binascii.unhexlify('00000003'),
|
#{'IP': '100.200.1.1', 'PORT': 50000, 'RADIO_ID': b'\x00\x00\x00\xFF'},
|
||||||
'AUTH_KEY': binascii.unhexlify('0000000000000000000000000000000000000333')
|
]
|
||||||
},
|
}
|
||||||
'MASTER': {
|
|
||||||
'IP': '3.3.3.3',
|
|
||||||
'MODE': b'\x6A',
|
|
||||||
'PORT': 50000,
|
|
||||||
'RADIO_ID': '',
|
|
||||||
},
|
|
||||||
'PEERS': [ # each list entry will be a dictionary for IP, RADIO ID and PORT
|
|
||||||
#{'IP': '100.200.1.1', 'PORT': 50000, 'RADIO_ID': b'\x00\x00\x00\xFF'},
|
|
||||||
]
|
|
||||||
},
|
|
||||||
'IPSC4': {
|
|
||||||
'LOCAL': {
|
|
||||||
'DESCRIPTION': 'IPSC Network #1',
|
|
||||||
'MODE': b'\x6A',
|
|
||||||
'FLAGS': b'\x00\x00\x80\xDC',
|
|
||||||
'PORT': 50004,
|
|
||||||
'RADIO_ID': binascii.unhexlify('00000004'),
|
|
||||||
'AUTH_KEY': binascii.unhexlify('0000000000000000000000000000000000004444')
|
|
||||||
},
|
|
||||||
'MASTER': {
|
|
||||||
'IP': '4.4.4.4',
|
|
||||||
'MODE': b'\x6A',
|
|
||||||
'PORT': 50000,
|
|
||||||
'RADIO_ID': '',
|
|
||||||
},
|
|
||||||
'PEERS': [ # each list entry will be a dictionary for IP, RADIO ID and PORT
|
|
||||||
#{'IP': '100.200.1.1', 'PORT': 50000, 'RADIO_ID': b'\x00\x00\x00\xFF'},
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Known IPSC Message Types
|
# Known IPSC Message Types
|
||||||
|
Loading…
Reference in New Issue
Block a user