Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
duniter
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
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
nodes
typescript
duniter
Commits
5e4997b5
Commit
5e4997b5
authored
7 years ago
by
Éloïs
Browse files
Options
Downloads
Patches
Plain Diff
[fix] wrong format WS_FULL_ADDRESS_ONION_REGEX
parent
40e3c3a7
No related branches found
No related tags found
1 merge request
!1178
Add WS2PTOR features
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/lib/common-libs/constants.ts
+1
-1
1 addition, 1 deletion
app/lib/common-libs/constants.ts
app/lib/proxy.ts
+2
-5
2 additions, 5 deletions
app/lib/proxy.ts
with
3 additions
and
6 deletions
app/lib/common-libs/constants.ts
+
1
−
1
View file @
5e4997b5
...
@@ -34,7 +34,7 @@ const BMA_REGEXP = /^BASIC_MERKLED_API( ([a-z_][a-z0-9-_.]*))?( ([0-9.]+))?( ([
...
@@ -34,7 +34,7 @@ const BMA_REGEXP = /^BASIC_MERKLED_API( ([a-z_][a-z0-9-_.]*))?( ([0-9.]+))?( ([
const
BMATOR_REGEXP
=
/^BMATOR
(
([
a-z0-9
]{16})\.
onion
)(
([
0-9.
]
+
))?(
([
0-9a-f:
]
+
))?(
([
0-9
]
+
))
$/
const
BMATOR_REGEXP
=
/^BMATOR
(
([
a-z0-9
]{16})\.
onion
)(
([
0-9.
]
+
))?(
([
0-9a-f:
]
+
))?(
([
0-9
]
+
))
$/
const
WS2P_REGEXP
=
/^WS2P
([
a-f0-9
]{8})
([
a-z_
][
a-z0-9-_.
]
*|
[
0-9.
]
+|
[
0-9a-f:
]
+
)
([
0-9
]
+
)(?:
(
.+
))?
$/
const
WS2P_REGEXP
=
/^WS2P
([
a-f0-9
]{8})
([
a-z_
][
a-z0-9-_.
]
*|
[
0-9.
]
+|
[
0-9a-f:
]
+
)
([
0-9
]
+
)(?:
(
.+
))?
$/
const
WS2PTOR_REGEXP
=
/^WS2PTOR
([
a-f0-9
]{8})
([
a-z0-9-_.
]
*|
[
0-9.
]
+|
[
0-9a-f:
]
+.onion
)
([
0-9
]
+
)(?:
(
.+
))?
$/
const
WS2PTOR_REGEXP
=
/^WS2PTOR
([
a-f0-9
]{8})
([
a-z0-9-_.
]
*|
[
0-9.
]
+|
[
0-9a-f:
]
+.onion
)
([
0-9
]
+
)(?:
(
.+
))?
$/
const
WS_FULL_ADDRESS_ONION_REGEX
=
/
'
^
(?:
wss
?
:
\/\/)(?:
www
\.)?([
0-9a-z
]{16}\.
onion
)(
:
[
0-9
]
+
)?
(\/[
-
\w]
*
)
*
/
const
WS_FULL_ADDRESS_ONION_REGEX
=
/^
(?:
wss
?
:
\/\/)(?:
www
\.)?([
0-9a-z
]{16}\.
onion
)(
:
[
0-9
]
+
)?
$
/
const
IPV4_REGEXP
=
/^
(([
0-9
]
|
[
1-9
][
0-9
]
|1
[
0-9
]{2}
|2
[
0-4
][
0-9
]
|25
[
0-5
])\.){3}([
0-9
]
|
[
1-9
][
0-9
]
|1
[
0-9
]{2}
|2
[
0-4
][
0-9
]
|25
[
0-5
])
$/
;
const
IPV4_REGEXP
=
/^
(([
0-9
]
|
[
1-9
][
0-9
]
|1
[
0-9
]{2}
|2
[
0-4
][
0-9
]
|25
[
0-5
])\.){3}([
0-9
]
|
[
1-9
][
0-9
]
|1
[
0-9
]{2}
|2
[
0-4
][
0-9
]
|25
[
0-5
])
$/
;
const
IPV6_REGEXP
=
/^
((([
0-9A-Fa-f
]{1,4}
:
){7}[
0-9A-Fa-f
]{1,4})
|
(([
0-9A-Fa-f
]{1,4}
:
){6}
:
[
0-9A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GEX
=
/^
(?:
www
\.)?([
0-9a-z
]{16}\.
onion
)
$/
const
HOST_ONION_REGEX
=
/^
(?:
www
\.)?([
0-9a-z
]{16}\.
onion
)
$/
...
...
This diff is collapsed.
Click to expand it.
app/lib/proxy.ts
+
2
−
5
View file @
5e4997b5
...
@@ -2,9 +2,6 @@ import {CommonConstants} from "./common-libs/constants"
...
@@ -2,9 +2,6 @@ import {CommonConstants} from "./common-libs/constants"
const
SocksProxyAgent
=
require
(
'
socks-proxy-agent
'
);
const
SocksProxyAgent
=
require
(
'
socks-proxy-agent
'
);
const
HOST_ONION_REGEX
=
new
RegExp
(
'
(?:www
\
.)?([0-9a-z]{16}?
\
.onion)$
'
);
const
WS_FULL_ADDRESS_ONION_REGEX
=
new
RegExp
(
'
^(?:wss?:
\
/
\
/)(?:www
\
.)?([0-9a-z]{16}
\
.onion)(:[0-9]+)?(
\
/[-
\
w]*)*
'
);
export
class
ProxiesConf
{
export
class
ProxiesConf
{
public
proxySocksAddress
:
string
|
undefined
public
proxySocksAddress
:
string
|
undefined
public
proxyTorAddress
:
string
|
undefined
public
proxyTorAddress
:
string
|
undefined
...
@@ -27,11 +24,11 @@ export class ProxiesConf {
...
@@ -27,11 +24,11 @@ export class ProxiesConf {
}
}
static
httpProxy
(
url
:
string
,
proxiesConf
:
ProxiesConf
|
undefined
):
string
|
undefined
{
static
httpProxy
(
url
:
string
,
proxiesConf
:
ProxiesConf
|
undefined
):
string
|
undefined
{
return
ProxiesConf
.
chooseProxyAgent
(
url
,
proxiesConf
,
HOST_ONION_REGEX
)
return
ProxiesConf
.
chooseProxyAgent
(
url
,
proxiesConf
,
CommonConstants
.
HOST_ONION_REGEX
)
}
}
static
wsProxy
(
address
:
string
,
proxiesConf
:
ProxiesConf
|
undefined
):
string
|
undefined
{
static
wsProxy
(
address
:
string
,
proxiesConf
:
ProxiesConf
|
undefined
):
string
|
undefined
{
return
ProxiesConf
.
chooseProxyAgent
(
address
,
proxiesConf
,
WS_FULL_ADDRESS_ONION_REGEX
)
return
ProxiesConf
.
chooseProxyAgent
(
address
,
proxiesConf
,
CommonConstants
.
WS_FULL_ADDRESS_ONION_REGEX
)
}
}
private
static
chooseProxyAgent
(
address
:
string
,
proxiesConf
:
ProxiesConf
|
undefined
,
onionRegex
:
RegExp
):
string
|
undefined
{
private
static
chooseProxyAgent
(
address
:
string
,
proxiesConf
:
ProxiesConf
|
undefined
,
onionRegex
:
RegExp
):
string
|
undefined
{
...
...
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