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
2f9fed1c
Commit
2f9fed1c
authored
Dec 26, 2019
by
Honfika
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
readme update
parent
7fe7ab6c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
16 deletions
+30
-16
README.md
README.md
+12
-11
ProxyTestController.cs
.../Titanium.Web.Proxy.Examples.Basic/ProxyTestController.cs
+18
-5
No files found.
README.md
View file @
2f9fed1c
...
...
@@ -15,6 +15,7 @@ Kindly report only issues/bugs here. For programming help or questions use [Stac
*
View/modify/redirect/block requests and responses
*
Supports mutual SSL authentication, proxy authentication & automatic upstream proxy detection
*
Kerberos/NTLM authentication over HTTP protocols for windows domain
*
SOCKS4/5 Proxy support
### Installation
Install by
[
nuget
](
https://www.nuget.org/packages/Titanium.Web.Proxy
)
...
...
@@ -29,21 +30,21 @@ For stable releases on [stable branch](https://github.com/justcoding121/Titanium
Supports
*
.N
et
Standard 2.0 or above
*
.N
et Framework 4.6.1
or above
*
.N
ET
Standard 2.0 or above
*
.N
ET Framework 4.5
or above
### Development environment
#### Windows
*
Visual Studio Code as IDE for .NET
c
ore
*
Visual Studio 201
7/2019 as IDE for .NET framework/.NET c
ore
*
Visual Studio Code as IDE for .NET
C
ore
*
Visual Studio 201
9 as IDE for .NET Framework/.NET C
ore
#### Mac OS
*
Visual Studio Code as IDE for .NET
c
ore
*
Visual Studio 201
7
as IDE for Mono
*
Visual Studio Code as IDE for .NET
C
ore
*
Visual Studio 201
9
as IDE for Mono
#### Linux
*
Visual Studio Code as IDE for .NET
c
ore
*
Visual Studio Code as IDE for .NET
C
ore
*
Mono develop as IDE for Mono
### Usage
...
...
@@ -191,7 +192,7 @@ public async Task OnResponse(object sender, SessionEventArgs e)
{
if
(
e
.
HttpClient
.
Response
.
ResponseStatusCode
==
"200"
)
{
if
(
e
.
HttpClient
.
Response
.
ContentType
!=
null
&&
e
.
HttpClient
.
Response
.
ContentType
.
Trim
().
ToLower
().
Contains
(
"text/html"
))
if
(
e
.
HttpClient
.
Response
.
ContentType
!=
null
&&
e
.
HttpClient
.
Response
.
ContentType
.
Trim
().
ToLower
().
Contains
(
"text/html"
))
{
byte
[]
bodyBytes
=
await
e
.
GetResponseBody
();
await
e
.
SetResponseBody
(
bodyBytes
);
...
...
@@ -202,7 +203,7 @@ public async Task OnResponse(object sender, SessionEventArgs e)
}
}
if
(
e
.
UserData
!=
null
)
if
(
e
.
UserData
!=
null
)
{
// access request from UserData property where we stored it in RequestHandler
var
request
=
(
Request
)
e
.
UserData
;
...
...
@@ -216,14 +217,14 @@ public Task OnCertificateValidation(object sender, CertificateValidationEventArg
if
(
e
.
SslPolicyErrors
==
System
.
Net
.
Security
.
SslPolicyErrors
.
None
)
e
.
IsValid
=
true
;
return
Task
.
FromResult
(
0
)
;
return
Task
.
CompletedTask
;
}
// Allows overriding default client certificate selection logic during mutual authentication
public
Task
OnCertificateSelection
(
object
sender
,
CertificateSelectionEventArgs
e
)
{
// set e.clientCertificate to override
return
Task
.
FromResult
(
0
)
;
return
Task
.
CompletedTask
;
}
```
### Note to contributors
...
...
examples/Titanium.Web.Proxy.Examples.Basic/ProxyTestController.cs
View file @
2f9fed1c
...
...
@@ -44,6 +44,10 @@ namespace Titanium.Web.Proxy.Examples.Basic
};
proxyServer
.
ForwardToUpstreamGateway
=
true
;
proxyServer
.
CertificateManager
.
SaveFakeCertificates
=
true
;
//proxyServer.ProxyBasicAuthenticateFunc = async (args, userName, password) =>
//{
// return true;
//};
// this is just to show the functionality, provided implementations use junk value
//proxyServer.GetCustomUpStreamProxyFunc = onGetCustomUpStreamProxyFunc;
...
...
@@ -94,8 +98,11 @@ namespace Titanium.Web.Proxy.Examples.Basic
//proxyServer.UpStreamHttpsProxy = new ExternalProxy("localhost", 8888);
// SOCKS proxy
//proxyServer.UpStreamHttpProxy = new ExternalProxy("46.63.0.17", 4145) { ProxyType = ExternalProxyType.Socks4 };
//proxyServer.UpStreamHttpsProxy = new ExternalProxy("46.63.0.17", 4145) { ProxyType = ExternalProxyType.Socks4 };
//proxyServer.UpStreamHttpProxy = new ExternalProxy("127.0.0.1", 1080)
// { ProxyType = ExternalProxyType.Socks5, UserName = "User1", Password = "Pass" };
//proxyServer.UpStreamHttpsProxy = new ExternalProxy("127.0.0.1", 1080)
// { ProxyType = ExternalProxyType.Socks5, UserName = "User1", Password = "Pass" };
//var socksEndPoint = new SocksProxyEndPoint(IPAddress.Any, 1080, true)
//{
...
...
@@ -167,6 +174,12 @@ namespace Titanium.Web.Proxy.Examples.Basic
e
.
GetState
().
PipelineInfo
.
AppendLine
(
nameof
(
onBeforeTunnelConnectRequest
)
+
":"
+
hostname
);
await
writeToConsole
(
"Tunnel to: "
+
hostname
);
var
clientLocalIp
=
e
.
ClientLocalEndPoint
.
Address
;
if
(!
clientLocalIp
.
Equals
(
IPAddress
.
Loopback
)
&&
!
clientLocalIp
.
Equals
(
IPAddress
.
IPv6Loopback
))
{
e
.
HttpClient
.
UpStreamEndPoint
=
new
IPEndPoint
(
clientLocalIp
,
0
);
}
if
(
hostname
.
Contains
(
"dropbox.com"
))
{
// Exclude Https addresses you don't want to proxy
...
...
@@ -212,7 +225,7 @@ namespace Titanium.Web.Proxy.Examples.Basic
{
e
.
GetState
().
PipelineInfo
.
AppendLine
(
nameof
(
onBeforeTunnelConnectResponse
)
+
":"
+
e
.
HttpClient
.
Request
.
RequestUri
);
return
Task
.
FromResult
(
false
)
;
return
Task
.
CompletedTask
;
}
// intercept & cancel redirect or update requests
...
...
@@ -356,7 +369,7 @@ namespace Titanium.Web.Proxy.Examples.Basic
e
.
IsValid
=
true
;
}
return
Task
.
FromResult
(
0
)
;
return
Task
.
CompletedTask
;
}
/// <summary>
...
...
@@ -370,7 +383,7 @@ namespace Titanium.Web.Proxy.Examples.Basic
// set e.clientCertificate to override
return
Task
.
FromResult
(
0
)
;
return
Task
.
CompletedTask
;
}
private
async
Task
writeToConsole
(
string
message
,
ConsoleColor
?
consoleColor
=
null
)
...
...
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