Skip to content

Commit

Permalink
feat: optimize dns objects by adding pxd files (#1113)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco committed Dec 18, 2022
1 parent a42e2d7 commit 919d4d8
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 0 deletions.
76 changes: 76 additions & 0 deletions src/zeroconf/_dns.pxd
@@ -0,0 +1,76 @@



cdef object _LEN_BYTE
cdef object _LEN_SHORT
cdef object _LEN_INT

cdef object _NAME_COMPRESSION_MIN_SIZE
cdef object _BASE_MAX_SIZE

cdef object _EXPIRE_FULL_TIME_MS
cdef object _EXPIRE_STALE_TIME_MS
cdef object _RECENT_TIME_MS


cdef class DNSEntry:

cdef public key
cdef public name
cdef public type
cdef public class_
cdef public unique

cdef class DNSQuestion(DNSEntry):

cdef public _hash

cdef class DNSRecord(DNSEntry):

cdef public ttl
cdef public created

cdef class DNSAddress(DNSRecord):

cdef public _hash
cdef public address
cdef public scope_id


cdef class DNSHinfo(DNSRecord):

cdef public _hash
cdef public cpu
cdef public os


cdef class DNSPointer(DNSRecord):

cdef public _hash
cdef public alias

cdef class DNSText(DNSRecord):

cdef public _hash
cdef public text

cdef class DNSService(DNSRecord):

cdef public _hash
cdef public priority
cdef public weight
cdef public port
cdef public server
cdef public server_key

cdef class DNSNsec(DNSRecord):

cdef public _hash
cdef public next_name
cdef public rdtypes


cdef class DNSRRSet:

cdef _records
cdef _lookup
3 changes: 3 additions & 0 deletions tests/services/test_browser.py
Expand Up @@ -427,6 +427,9 @@ def _mock_get_expiration_time(self, percent):
service_removed_event.wait(wait_time)
assert service_added_count == 3
assert service_removed_count == 3
except TypeError:
# Cannot be patched with cython as get_expiration_time is immutable
pass

finally:
assert len(zeroconf.listeners) == 1
Expand Down

0 comments on commit 919d4d8

Please sign in to comment.