Home
About
Blog
Products
Forum
Support
Contact
Sunbelt Computer Software
PL/B Language Development and Support
Home
About
Blog
Products
Forum
Support
Contact
python-zeroconf/src/zeroconf/const.py at view_type · python-zeroconf/python-zeroconf · GitHub
Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
View all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
python-zeroconf
python-zeroconf
Repository navigation
Code
Issues
48
(48)
Pull requests
12
(12)
Discussions
Actions
Projects
Wiki
Security and quality
5
(5)
Insights
More
items
Files
Expand file tree
view_type
Breadcrumbs
python-zeroconf
/
src
/
zeroconf
/
const.py
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
161 lines (134 loc) · 4.35 KB
view_type
Breadcrumbs
python-zeroconf
/
src
/
zeroconf
/
const.py
Copy path
Top
File metadata and controls
Code
Blame
161 lines (134 loc) · 4.35 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
"""Multicast DNS Service Discovery for Python, v0.14-wmcbrine
Copyright 2003 Paul Scott-Murphy, 2014 William McBrine
This module provides a framework for the use of DNS Service Discovery
using IP multicast.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
"""
from
__future__
import
annotations
import
re
import
socket
# Some timing constants
_UNREGISTER_TIME
=
125
# ms
_CHECK_TIME
=
175
# ms
_REGISTER_TIME
=
225
# ms
_LISTENER_TIME
=
200
# ms
_BROWSER_TIME
=
10000
# ms
_DUPLICATE_PACKET_SUPPRESSION_INTERVAL
=
1000
# ms
_DUPLICATE_QUESTION_INTERVAL
=
999
# ms # Must be 1ms less than _DUPLICATE_PACKET_SUPPRESSION_INTERVAL
_CACHE_CLEANUP_INTERVAL
=
10
# s
_LOADED_SYSTEM_TIMEOUT
=
10
# s
_STARTUP_TIMEOUT
=
9
# s must be lower than _LOADED_SYSTEM_TIMEOUT
_ONE_SECOND
=
1000
# ms
# If the system is loaded or the event
# loop was blocked by another task that was doing I/O in the loop
# (shouldn't happen but it does in practice) we need to give
# a buffer timeout to ensure a coroutine can finish before
# the future times out
# Some DNS constants
_MDNS_ADDR
=
"224.0.0.251"
_MDNS_ADDR6
=
"ff02::fb"
_MDNS_PORT
=
5353
_DNS_PORT
=
53
_DNS_HOST_TTL
=
120
# two minute for host records (A, SRV etc) as-per RFC6762
_DNS_OTHER_TTL
=
4500
# 75 minutes for non-host records (PTR, TXT etc) as-per RFC6762
# Currently we enforce a minimum TTL for PTR records to avoid
# ServiceBrowsers generating excessive queries refresh queries.
# Apple uses a 15s minimum TTL, however we do not have the same
# level of rate limit and safe guards so we use 1/4 of the recommended value
_DNS_PTR_MIN_TTL
=
_DNS_OTHER_TTL
/
4
_DNS_PACKET_HEADER_LEN
=
12
_MAX_MSG_TYPICAL
=
1460
# unused
_MAX_MSG_ABSOLUTE
=
8966
_FLAGS_QR_MASK
=
0x8000
# query response mask
_FLAGS_QR_QUERY
=
0x0000
# query
_FLAGS_QR_RESPONSE
=
0x8000
# response
_FLAGS_AA
=
0x0400
# Authoritative answer
_FLAGS_TC
=
0x0200
# Truncated
_FLAGS_RD
=
0x0100
# Recursion desired
_FLAGS_RA
=
0x8000
# Recursion available
_FLAGS_Z
=
0x0040
# Zero
_FLAGS_AD
=
0x0020
# Authentic data
_FLAGS_CD
=
0x0010
# Checking disabled
_CLASS_IN
=
1
_CLASS_CS
=
2
_CLASS_CH
=
3
_CLASS_HS
=
4
_CLASS_NONE
=
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z0-9\-]+$"
)
_HAS_ONLY_A_TO_Z_NUM_HYPHEN_UNDERSCORE
=
re
.
compile
(
r"^[A-Za-z0-9\-\_]+$"
)
_HAS_ASCII_CONTROL_CHARS
=
re
.
compile
(
r"[\x00-\x1f\x7f]"
)
_EXPIRE_REFRESH_TIME_PERCENT
=
75
_LOCAL_TRAILER
=
".local."
_TCP_PROTOCOL_LOCAL_TRAILER
=
"._tcp.local."
_NONTCP_PROTOCOL_LOCAL_TRAILER
=
"._udp.local."
# https://datatracker.ietf.org/doc/html/rfc6763#section-9
_SERVICE_TYPE_ENUMERATION_NAME
=
"_services._dns-sd._udp.local."
_IPPROTO_IPV6
=
socket
.
IPPROTO_IPV6
You can’t perform that action at this time.