netbox/netbox/utilities/constants.py
Arthur Hanson 92d8aa583a
Add support for socks connection to Git backend (#17640)
* Add support for socks connection to Git backend

* cleanup socks detection

* add documentation for installing python_socks

* dont need lower()

* cleanup

* refactor Socks to utilities

* fix imports

* fix missing comma

* Update docs/features/synchronized-data.md

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>

* review feedback

* Update docs/features/synchronized-data.md

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>

* review changes

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2024-10-01 12:11:44 -04:00

100 lines
2.0 KiB
Python

#
# Filter lookup expressions
#
FILTER_CHAR_BASED_LOOKUP_MAP = dict(
n='exact',
ic='icontains',
nic='icontains',
iew='iendswith',
niew='iendswith',
isw='istartswith',
nisw='istartswith',
ie='iexact',
nie='iexact',
empty='empty',
)
FILTER_NUMERIC_BASED_LOOKUP_MAP = dict(
n='exact',
lte='lte',
lt='lt',
gte='gte',
gt='gt',
empty='isnull',
)
FILTER_NEGATION_LOOKUP_MAP = dict(
n='exact'
)
FILTER_TREENODE_NEGATION_LOOKUP_MAP = dict(
n='in'
)
#
# HTTP Request META safe copy
#
HTTP_REQUEST_META_SAFE_COPY = [
'CONTENT_LENGTH',
'CONTENT_TYPE',
'HTTP_ACCEPT',
'HTTP_ACCEPT_ENCODING',
'HTTP_ACCEPT_LANGUAGE',
'HTTP_HOST',
'HTTP_REFERER',
'HTTP_USER_AGENT',
'HTTP_X_FORWARDED_FOR',
'HTTP_X_FORWARDED_HOST',
'HTTP_X_FORWARDED_PORT',
'HTTP_X_FORWARDED_PROTO',
'HTTP_X_REAL_IP',
'QUERY_STRING',
'REMOTE_ADDR',
'REMOTE_HOST',
'REMOTE_USER',
'REQUEST_METHOD',
'SERVER_NAME',
'SERVER_PORT',
]
#
# CSV-style format delimiters
#
CSV_DELIMITERS = {
'comma': ',',
'semicolon': ';',
'tab': '\t',
}
#
# HTML allowed tags & attributes
#
HTML_ALLOWED_TAGS = {
"a", "b", "blockquote", "br", "code", "dd", "del", "div", "dl", "dt", "em", "h1", "h2", "h3", "h4", "h5", "h6",
"hr", "i", "img", "li", "ol", "p", "pre", "strong", "table", "tbody", "td", "th", "thead", "tr", "ul"
}
HTML_ALLOWED_ATTRIBUTES = {
"a": {"href", "title"},
"div": {"class"},
"h1": {"id"},
"h2": {"id"},
"h3": {"id"},
"h4": {"id"},
"h5": {"id"},
"h6": {"id"},
"img": {"alt", "src", "title"},
"td": {"align"},
"th": {"align"},
}
HTTP_PROXY_SUPPORTED_SOCK_SCHEMAS = ['socks4', 'socks4a', 'socks4h', 'socks5', 'socks5a', 'socks5h']
HTTP_PROXY_SOCK_RDNS_SCHEMAS = ['socks4h', 'socks4a', 'socks5h', 'socks5a']
HTTP_PROXY_SUPPORTED_SCHEMAS = ['http', 'https', 'socks4', 'socks4a', 'socks4h', 'socks5', 'socks5a', 'socks5h']