mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-01 23:25:38 +00:00
Shorten syntax to access Name object
dns.name all over the place does not make it easier to read the code at
all, and I'm going to add lot more code here.
(cherry picked from commit 3fb6b990af
)
This commit is contained in:
@@ -9,12 +9,12 @@
|
|||||||
# See the COPYRIGHT file distributed with this work for additional
|
# See the COPYRIGHT file distributed with this work for additional
|
||||||
# information regarding copyright ownership.
|
# information regarding copyright ownership.
|
||||||
|
|
||||||
import dns.name
|
from dns.name import Name
|
||||||
|
|
||||||
|
|
||||||
def prepend_label(label: str, name: dns.name.Name) -> dns.name.Name:
|
def prepend_label(label: str, name: Name) -> Name:
|
||||||
return dns.name.Name((label,) + name.labels)
|
return Name((label,) + name.labels)
|
||||||
|
|
||||||
|
|
||||||
def len_wire_uncompressed(name: dns.name.Name) -> int:
|
def len_wire_uncompressed(name: Name) -> int:
|
||||||
return len(name) + sum(map(len, name.labels))
|
return len(name) + sum(map(len, name.labels))
|
||||||
|
Reference in New Issue
Block a user