Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
briar
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Julian Dehm
briar
Commits
a65bda04
Verified
Commit
a65bda04
authored
May 17, 2018
by
akwizgran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use more realistic LAN addresses for test contacts.
parent
ed2c0336
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
5 deletions
+16
-5
briar-core/src/main/java/org/briarproject/briar/test/TestDataCreatorImpl.java
...java/org/briarproject/briar/test/TestDataCreatorImpl.java
+16
-5
No files found.
briar-core/src/main/java/org/briarproject/briar/test/TestDataCreatorImpl.java
View file @
a65bda04
...
...
@@ -113,6 +113,7 @@ public class TestDataCreatorImpl implements TestDataCreator {
this
.
ioExecutor
=
ioExecutor
;
}
@Override
public
void
createTestData
(
int
numContacts
,
int
numPrivateMsgs
,
int
numBlogPosts
,
int
numForums
,
int
numForumPosts
)
{
if
(
numContacts
==
0
)
...
...
@@ -216,8 +217,12 @@ public class TestDataCreatorImpl implements TestDataCreator {
// LAN
TransportProperties
lan
=
new
TransportProperties
();
String
lanAddress
=
getRandomLanAddress
();
lan
.
put
(
LanTcpConstants
.
PROP_IP_PORTS
,
lanAddress
);
StringBuilder
sb
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
4
;
i
++)
{
if
(
sb
.
length
()
>
0
)
sb
.
append
(
','
);
sb
.
append
(
getRandomLanAddress
());
}
lan
.
put
(
LanTcpConstants
.
PROP_IP_PORTS
,
sb
.
toString
());
props
.
put
(
LanTcpConstants
.
ID
,
lan
);
// Tor
...
...
@@ -250,8 +255,14 @@ public class TestDataCreatorImpl implements TestDataCreator {
private
String
getRandomLanAddress
()
{
StringBuilder
sb
=
new
StringBuilder
();
// address
for
(
int
i
=
0
;
i
<
4
;
i
++)
{
if
(
sb
.
length
()
>
0
)
sb
.
append
(
"."
);
if
(
random
.
nextInt
(
5
)
==
0
)
{
sb
.
append
(
"10."
);
sb
.
append
(
random
.
nextInt
(
2
)).
append
(
'.'
);
sb
.
append
(
random
.
nextInt
(
2
)).
append
(
'.'
);
sb
.
append
(
random
.
nextInt
(
256
));
}
else
{
sb
.
append
(
"192.168."
);
sb
.
append
(
random
.
nextInt
(
2
)).
append
(
'.'
);
sb
.
append
(
random
.
nextInt
(
256
));
}
// port
...
...
@@ -264,7 +275,7 @@ public class TestDataCreatorImpl implements TestDataCreator {
StringBuilder
sb
=
new
StringBuilder
();
// address
for
(
int
i
=
0
;
i
<
16
;
i
++)
{
if
(
random
.
nextBoolean
())
sb
.
append
(
2
+
random
.
nextInt
(
5
));
if
(
random
.
nextBoolean
())
sb
.
append
(
2
+
random
.
nextInt
(
6
));
else
sb
.
append
((
char
)
(
random
.
nextInt
(
26
)
+
'a'
));
}
return
sb
.
toString
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment