Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
opendht
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
opendht
Commits
29efd42d
Commit
29efd42d
authored
1 year ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
python: add binding for SockAddr.resolve
parent
ae2a1d83
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
python/opendht.pyx
+9
-0
9 additions, 0 deletions
python/opendht.pyx
python/opendht_cpp.pxd
+2
-0
2 additions, 0 deletions
python/opendht_cpp.pxd
with
11 additions
and
0 deletions
python/opendht.pyx
+
9
−
0
View file @
29efd42d
...
...
@@ -158,6 +158,15 @@ cdef class SockAddr(object):
return
self
.
toString
().
decode
()
def
__repr__
(
self
):
return
"
<%s
'
%s
'
>
"
%
(
self
.
__class__
.
__name__
,
str
(
self
))
@staticmethod
def
resolve
(
str
host
,
str
service
=
None
):
vals
=
[]
result
=
cpp
.
SockAddr
.
resolve
(
host
.
encode
(),
service
.
encode
()
if
service
else
b
''
)
for
val
in
result
:
a
=
SockAddr
()
a
.
_addr
=
val
vals
.
append
(
a
)
return
vals
cdef
class
Node
(
_WithID
):
cdef
shared_ptr
[
cpp
.
Node
]
_node
...
...
This diff is collapsed.
Click to expand it.
python/opendht_cpp.pxd
+
2
−
0
View file @
29efd42d
...
...
@@ -86,6 +86,8 @@ cdef extern from "opendht/sockaddr.h" namespace "dht":
bool
isLoopback
()
const
bool
isPrivate
()
const
bool
isUnspecified
()
const
@staticmethod
vector
[
SockAddr
]
resolve
(
string
host
,
string
service
)
except
+
ctypedef
vector
[
uint8_t
]
Blob
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment