Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
DuniterPy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
clients
python
DuniterPy
Commits
65cc922e
Commit
65cc922e
authored
7 years ago
by
inso
Browse files
Options
Downloads
Patches
Plain Diff
Fix ipv6 format
parent
b0fdd2d1
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
duniterpy/documents/constants.py
+2
-2
2 additions, 2 deletions
duniterpy/documents/constants.py
duniterpy/documents/peer.py
+2
-1
2 additions, 1 deletion
duniterpy/documents/peer.py
tests/documents/test_peer.py
+6
-6
6 additions, 6 deletions
tests/documents/test_peer.py
with
10 additions
and
9 deletions
duniterpy/documents/constants.py
+
2
−
2
View file @
65cc922e
...
@@ -10,5 +10,5 @@ block_uid_regex = "{block_id_regex}-{block_hash_regex}".format(block_id_regex=bl
...
@@ -10,5 +10,5 @@ block_uid_regex = "{block_id_regex}-{block_hash_regex}".format(block_id_regex=bl
block_hash_regex
=
block_hash_regex
)
block_hash_regex
=
block_hash_regex
)
conditions_regex
=
"
(&&|\|\|| |[()]|(SIG\({pubkey_regex}\)|(XHX\({hash_regex}\))))*
"
\
conditions_regex
=
"
(&&|\|\|| |[()]|(SIG\({pubkey_regex}\)|(XHX\({hash_regex}\))))*
"
\
.
format
(
pubkey_regex
=
pubkey_regex
,
hash_regex
=
hash_regex
)
.
format
(
pubkey_regex
=
pubkey_regex
,
hash_regex
=
hash_regex
)
ipv4_regex
=
'
(?:(?:[0-9]|[1-9][0-9]|1[0-9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-Fa-f]{1,4})?::[0-9A-Fa-f]{1,4}|(?:(?:[0-9A-Fa-f]{1,4}:){,6}[0-9A-Fa-f]{1,4})?::)
'
This diff is collapsed.
Click to expand it.
duniterpy/documents/peer.py
+
2
−
1
View file @
65cc922e
...
@@ -166,6 +166,7 @@ class BMAEndpoint(Endpoint):
...
@@ -166,6 +166,7 @@ class BMAEndpoint(Endpoint):
@classmethod
@classmethod
def
from_inline
(
cls
,
inline
):
def
from_inline
(
cls
,
inline
):
m
=
BMAEndpoint
.
re_inline
.
match
(
inline
)
m
=
BMAEndpoint
.
re_inline
.
match
(
inline
)
str_re
=
BMAEndpoint
.
re_inline
.
pattern
if
m
is
None
:
if
m
is
None
:
raise
MalformedDocumentError
(
"
BMAEndpoint
"
)
raise
MalformedDocumentError
(
"
BMAEndpoint
"
)
server
=
m
.
group
(
1
)
server
=
m
.
group
(
1
)
...
...
This diff is collapsed.
Click to expand it.
tests/documents/test_peer.py
+
6
−
6
View file @
65cc922e
...
@@ -13,8 +13,8 @@ Currency: beta_brousouf
...
@@ -13,8 +13,8 @@ Currency: beta_brousouf
PublicKey: HsLShAtzXTVxeUtQd7yi5Z5Zh4zNvbu8sTEZ53nfKcqY
PublicKey: HsLShAtzXTVxeUtQd7yi5Z5Zh4zNvbu8sTEZ53nfKcqY
Block: 8-1922C324ABC4AF7EF7656734A31F5197888DDD52
Block: 8-1922C324ABC4AF7EF7656734A31F5197888DDD52
Endpoints:
Endpoints:
BASIC_MERKLED_API some.dns.name 88.77.66.55 2001:
0db8:0000:85a3:0000:0000:ac1f
9001
BASIC_MERKLED_API some.dns.name 88.77.66.55 2001:
42d0:52:a00::648
9001
BASIC_MERKLED_API some.dns.name 88.77.66.55 2001:
0db8:0000:85a3:0000:0000:ac1f
9002
BASIC_MERKLED_API some.dns.name 88.77.66.55 2001:
42d0:52:a00::648
9002
OTHER_PROTOCOL 88.77.66.55 9001
OTHER_PROTOCOL 88.77.66.55 9001
dkaXIiCYUJtCg8Feh/BKvPYf4uFH9CJ/zY6J4MlA9BsjmcMe4YAblvNt/gJy31b1aGq3ue3h14mLMCu84rraDg==
dkaXIiCYUJtCg8Feh/BKvPYf4uFH9CJ/zY6J4MlA9BsjmcMe4YAblvNt/gJy31b1aGq3ue3h14mLMCu84rraDg==
"""
"""
...
@@ -45,12 +45,12 @@ class TestPeer(unittest.TestCase):
...
@@ -45,12 +45,12 @@ class TestPeer(unittest.TestCase):
self
.
assertEqual
(
peer
.
endpoints
[
0
].
server
,
"
some.dns.name
"
)
self
.
assertEqual
(
peer
.
endpoints
[
0
].
server
,
"
some.dns.name
"
)
self
.
assertEqual
(
peer
.
endpoints
[
0
].
ipv4
,
"
88.77.66.55
"
)
self
.
assertEqual
(
peer
.
endpoints
[
0
].
ipv4
,
"
88.77.66.55
"
)
self
.
assertEqual
(
peer
.
endpoints
[
0
].
ipv6
,
"
2001:
0db8:0000:85a3:0000:0000:ac1f
"
)
self
.
assertEqual
(
peer
.
endpoints
[
0
].
ipv6
,
"
2001:
42d0:52:a00::648
"
)
self
.
assertEqual
(
peer
.
endpoints
[
0
].
port
,
9001
)
self
.
assertEqual
(
peer
.
endpoints
[
0
].
port
,
9001
)
self
.
assertEqual
(
peer
.
endpoints
[
1
].
server
,
"
some.dns.name
"
)
self
.
assertEqual
(
peer
.
endpoints
[
1
].
server
,
"
some.dns.name
"
)
self
.
assertEqual
(
peer
.
endpoints
[
1
].
ipv4
,
"
88.77.66.55
"
)
self
.
assertEqual
(
peer
.
endpoints
[
1
].
ipv4
,
"
88.77.66.55
"
)
self
.
assertEqual
(
peer
.
endpoints
[
1
].
ipv6
,
"
2001:
0db8:0000:85a3:0000:0000:ac1f
"
)
self
.
assertEqual
(
peer
.
endpoints
[
1
].
ipv6
,
"
2001:
42d0:52:a00::648
"
)
self
.
assertEqual
(
peer
.
endpoints
[
1
].
port
,
9002
)
self
.
assertEqual
(
peer
.
endpoints
[
1
].
port
,
9002
)
self
.
assertEqual
(
peer
.
signatures
[
0
],
"
dkaXIiCYUJtCg8Feh/BKvPYf4uFH9CJ/zY6J4MlA9BsjmcMe4YAblvNt/gJy31b1aGq3ue3h14mLMCu84rraDg==
"
)
self
.
assertEqual
(
peer
.
signatures
[
0
],
"
dkaXIiCYUJtCg8Feh/BKvPYf4uFH9CJ/zY6J4MlA9BsjmcMe4YAblvNt/gJy31b1aGq3ue3h14mLMCu84rraDg==
"
)
...
@@ -70,12 +70,12 @@ class TestPeer(unittest.TestCase):
...
@@ -70,12 +70,12 @@ class TestPeer(unittest.TestCase):
self
.
assertEqual
(
from_rendered_peer
.
endpoints
[
0
].
server
,
"
some.dns.name
"
)
self
.
assertEqual
(
from_rendered_peer
.
endpoints
[
0
].
server
,
"
some.dns.name
"
)
self
.
assertEqual
(
from_rendered_peer
.
endpoints
[
0
].
ipv4
,
"
88.77.66.55
"
)
self
.
assertEqual
(
from_rendered_peer
.
endpoints
[
0
].
ipv4
,
"
88.77.66.55
"
)
self
.
assertEqual
(
from_rendered_peer
.
endpoints
[
0
].
ipv6
,
"
2001:
0db8:0000:85a3:0000:0000:ac1f
"
)
self
.
assertEqual
(
from_rendered_peer
.
endpoints
[
0
].
ipv6
,
"
2001:
42d0:52:a00::648
"
)
self
.
assertEqual
(
from_rendered_peer
.
endpoints
[
0
].
port
,
9001
)
self
.
assertEqual
(
from_rendered_peer
.
endpoints
[
0
].
port
,
9001
)
self
.
assertEqual
(
from_rendered_peer
.
endpoints
[
1
].
server
,
"
some.dns.name
"
)
self
.
assertEqual
(
from_rendered_peer
.
endpoints
[
1
].
server
,
"
some.dns.name
"
)
self
.
assertEqual
(
from_rendered_peer
.
endpoints
[
1
].
ipv4
,
"
88.77.66.55
"
)
self
.
assertEqual
(
from_rendered_peer
.
endpoints
[
1
].
ipv4
,
"
88.77.66.55
"
)
self
.
assertEqual
(
from_rendered_peer
.
endpoints
[
1
].
ipv6
,
"
2001:
0db8:0000:85a3:0000:0000:ac1f
"
)
self
.
assertEqual
(
from_rendered_peer
.
endpoints
[
1
].
ipv6
,
"
2001:
42d0:52:a00::648
"
)
self
.
assertEqual
(
from_rendered_peer
.
endpoints
[
1
].
port
,
9002
)
self
.
assertEqual
(
from_rendered_peer
.
endpoints
[
1
].
port
,
9002
)
self
.
assertEqual
(
from_rendered_peer
.
signatures
[
0
],
"
dkaXIiCYUJtCg8Feh/BKvPYf4uFH9CJ/zY6J4MlA9BsjmcMe4YAblvNt/gJy31b1aGq3ue3h14mLMCu84rraDg==
"
)
self
.
assertEqual
(
from_rendered_peer
.
signatures
[
0
],
"
dkaXIiCYUJtCg8Feh/BKvPYf4uFH9CJ/zY6J4MlA9BsjmcMe4YAblvNt/gJy31b1aGq3ue3h14mLMCu84rraDg==
"
)
...
...
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