Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
Titanium-Web-Proxy
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Titanium-Web-Proxy
Commits
ee3513c1
Commit
ee3513c1
authored
May 10, 2017
by
Honfika
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Inconsistent naming fixes
parent
34899ebf
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
48 deletions
+48
-48
Program.cs
Examples/Titanium.Web.Proxy.Examples.Basic/Program.cs
+4
-4
Network.cs
Titanium.Web.Proxy/Helpers/Network.cs
+38
-38
EndPoint.cs
Titanium.Web.Proxy/Models/EndPoint.cs
+6
-6
No files found.
Examples/Titanium.Web.Proxy.Examples.Basic/Program.cs
View file @
ee3513c1
...
@@ -5,7 +5,7 @@ namespace Titanium.Web.Proxy.Examples.Basic
...
@@ -5,7 +5,7 @@ namespace Titanium.Web.Proxy.Examples.Basic
{
{
public
class
Program
public
class
Program
{
{
private
static
readonly
ProxyTestController
C
ontroller
=
new
ProxyTestController
();
private
static
readonly
ProxyTestController
c
ontroller
=
new
ProxyTestController
();
public
static
void
Main
(
string
[]
args
)
public
static
void
Main
(
string
[]
args
)
{
{
...
@@ -15,13 +15,13 @@ namespace Titanium.Web.Proxy.Examples.Basic
...
@@ -15,13 +15,13 @@ namespace Titanium.Web.Proxy.Examples.Basic
//Start proxy controller
//Start proxy controller
C
ontroller
.
StartProxy
();
c
ontroller
.
StartProxy
();
Console
.
WriteLine
(
"Hit any key to exit.."
);
Console
.
WriteLine
(
"Hit any key to exit.."
);
Console
.
WriteLine
();
Console
.
WriteLine
();
Console
.
Read
();
Console
.
Read
();
C
ontroller
.
Stop
();
c
ontroller
.
Stop
();
}
}
...
@@ -30,7 +30,7 @@ namespace Titanium.Web.Proxy.Examples.Basic
...
@@ -30,7 +30,7 @@ namespace Titanium.Web.Proxy.Examples.Basic
if
(
eventType
!=
2
)
return
false
;
if
(
eventType
!=
2
)
return
false
;
try
try
{
{
C
ontroller
.
Stop
();
c
ontroller
.
Stop
();
}
}
catch
catch
{
{
...
...
Titanium.Web.Proxy/Helpers/Network.cs
View file @
ee3513c1
using
System.Linq
;
using
System.Linq
;
using
System.Net
;
using
System.Net
;
using
System.Net.Sockets
;
using
System.Net.Sockets
;
namespace
Titanium.Web.Proxy.Helpers
namespace
Titanium.Web.Proxy.Helpers
{
{
internal
class
NetworkHelper
internal
class
NetworkHelper
{
{
private
static
int
FindProcessIdFromLocalPort
(
int
port
,
IpVersion
ipVersion
)
private
static
int
FindProcessIdFromLocalPort
(
int
port
,
IpVersion
ipVersion
)
{
{
var
tcpRow
=
TcpHelper
.
GetExtendedTcpTable
(
ipVersion
).
FirstOrDefault
(
var
tcpRow
=
TcpHelper
.
GetExtendedTcpTable
(
ipVersion
).
FirstOrDefault
(
row
=>
row
.
LocalEndPoint
.
Port
==
port
);
row
=>
row
.
LocalEndPoint
.
Port
==
port
);
return
tcpRow
?.
ProcessId
??
0
;
return
tcpRow
?.
ProcessId
??
0
;
}
}
internal
static
int
GetProcessIdFromPort
(
int
port
,
bool
ipV6Enabled
)
internal
static
int
GetProcessIdFromPort
(
int
port
,
bool
ipV6Enabled
)
{
{
var
processId
=
FindProcessIdFromLocalPort
(
port
,
IpVersion
.
Ipv4
);
var
processId
=
FindProcessIdFromLocalPort
(
port
,
IpVersion
.
Ipv4
);
if
(
processId
>
0
&&
!
ipV6Enabled
)
if
(
processId
>
0
&&
!
ipV6Enabled
)
{
{
return
processId
;
return
processId
;
}
}
return
FindProcessIdFromLocalPort
(
port
,
IpVersion
.
Ipv6
);
return
FindProcessIdFromLocalPort
(
port
,
IpVersion
.
Ipv6
);
}
}
/// <summary>
/// <summary>
/// Adapated from below link
/// Adapated from below link
/// http://stackoverflow.com/questions/11834091/how-to-check-if-localhost
/// http://stackoverflow.com/questions/11834091/how-to-check-if-localhost
/// </summary>
/// </summary>
/// <param name="address"></param>
/// <param name="address"></param>
/// <returns></returns>
/// <returns></returns>
internal
static
bool
IsLocalIpAddress
(
IPAddress
address
)
internal
static
bool
IsLocalIpAddress
(
IPAddress
address
)
{
{
// get local IP addresses
// get local IP addresses
...
@@ -40,8 +40,8 @@ namespace Titanium.Web.Proxy.Helpers
...
@@ -40,8 +40,8 @@ namespace Titanium.Web.Proxy.Helpers
return
IPAddress
.
IsLoopback
(
address
)
||
localIPs
.
Contains
(
address
);
return
IPAddress
.
IsLoopback
(
address
)
||
localIPs
.
Contains
(
address
);
}
}
internal
static
bool
IsLocalIpAddress
(
string
hostName
)
internal
static
bool
IsLocalIpAddress
(
string
hostName
)
{
{
bool
isLocalhost
=
false
;
bool
isLocalhost
=
false
;
IPHostEntry
localhost
=
Dns
.
GetHostEntry
(
"127.0.0.1"
);
IPHostEntry
localhost
=
Dns
.
GetHostEntry
(
"127.0.0.1"
);
...
@@ -74,7 +74,7 @@ namespace Titanium.Web.Proxy.Helpers
...
@@ -74,7 +74,7 @@ namespace Titanium.Web.Proxy.Helpers
}
}
}
}
return
isLocalhost
;
return
isLocalhost
;
}
}
}
}
}
}
Titanium.Web.Proxy/Models/EndPoint.cs
View file @
ee3513c1
...
@@ -53,8 +53,8 @@ namespace Titanium.Web.Proxy.Models
...
@@ -53,8 +53,8 @@ namespace Titanium.Web.Proxy.Models
/// </summary>
/// </summary>
public
class
ExplicitProxyEndPoint
:
ProxyEndPoint
public
class
ExplicitProxyEndPoint
:
ProxyEndPoint
{
{
private
List
<
string
>
_
excludedHttpsHostNameRegex
;
private
List
<
string
>
excludedHttpsHostNameRegex
;
private
List
<
string
>
_
includedHttpsHostNameRegex
;
private
List
<
string
>
includedHttpsHostNameRegex
;
internal
bool
IsSystemHttpProxy
{
get
;
set
;
}
internal
bool
IsSystemHttpProxy
{
get
;
set
;
}
...
@@ -65,7 +65,7 @@ namespace Titanium.Web.Proxy.Models
...
@@ -65,7 +65,7 @@ namespace Titanium.Web.Proxy.Models
/// </summary>
/// </summary>
public
List
<
string
>
ExcludedHttpsHostNameRegex
public
List
<
string
>
ExcludedHttpsHostNameRegex
{
{
get
{
return
_
excludedHttpsHostNameRegex
;
}
get
{
return
excludedHttpsHostNameRegex
;
}
set
set
{
{
if
(
IncludedHttpsHostNameRegex
!=
null
)
if
(
IncludedHttpsHostNameRegex
!=
null
)
...
@@ -73,7 +73,7 @@ namespace Titanium.Web.Proxy.Models
...
@@ -73,7 +73,7 @@ namespace Titanium.Web.Proxy.Models
throw
new
ArgumentException
(
"Cannot set excluded when included is set"
);
throw
new
ArgumentException
(
"Cannot set excluded when included is set"
);
}
}
_
excludedHttpsHostNameRegex
=
value
;
excludedHttpsHostNameRegex
=
value
;
}
}
}
}
...
@@ -82,7 +82,7 @@ namespace Titanium.Web.Proxy.Models
...
@@ -82,7 +82,7 @@ namespace Titanium.Web.Proxy.Models
/// </summary>
/// </summary>
public
List
<
string
>
IncludedHttpsHostNameRegex
public
List
<
string
>
IncludedHttpsHostNameRegex
{
{
get
{
return
_
includedHttpsHostNameRegex
;
}
get
{
return
includedHttpsHostNameRegex
;
}
set
set
{
{
if
(
ExcludedHttpsHostNameRegex
!=
null
)
if
(
ExcludedHttpsHostNameRegex
!=
null
)
...
@@ -90,7 +90,7 @@ namespace Titanium.Web.Proxy.Models
...
@@ -90,7 +90,7 @@ namespace Titanium.Web.Proxy.Models
throw
new
ArgumentException
(
"Cannot set included when excluded is set"
);
throw
new
ArgumentException
(
"Cannot set included when excluded is set"
);
}
}
_
includedHttpsHostNameRegex
=
value
;
includedHttpsHostNameRegex
=
value
;
}
}
}
}
...
...
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