This repository was archived by the owner on Feb 21, 2023. It is now read-only.
forked from dparmar/LittleProxy
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathFlowContext.java
More file actions
60 lines (50 loc) · 1.43 KB
/
FlowContext.java
File metadata and controls
60 lines (50 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package org.littleshoot.proxy;
import java.net.InetSocketAddress;
import javax.net.ssl.SSLEngine;
import javax.net.ssl.SSLSession;
import org.littleshoot.proxy.impl.ClientToProxyConnection;
import io.netty.channel.ChannelHandlerContext;
/**
* <p>
* Encapsulates contextual information for flow information that's being
* reported to a {@link ActivityTracker}.
* </p>
*/
public class FlowContext {
private final InetSocketAddress clientAddress;
private final SSLSession clientSslSession;
private final ChannelHandlerContext ctx;
public FlowContext(ClientToProxyConnection clientConnection) {
super();
this.ctx = clientConnection.getContext();
this.clientAddress = clientConnection.getClientAddress();
SSLEngine sslEngine = clientConnection.getSslEngine();
this.clientSslSession = sslEngine != null ? sslEngine.getSession()
: null;
}
/**
* The client to proxy channel context.
*
* @return
*/
public ChannelHandlerContext getClientToProxyContext() {
return ctx;
}
/**
* The address of the client.
*
* @return
*/
public InetSocketAddress getClientAddress() {
return clientAddress;
}
/**
* If using SSL, this returns the {@link SSLSession} on the client
* connection.
*
* @return
*/
public SSLSession getClientSslSession() {
return clientSslSession;
}
}