string name = 1;
94 | */
95 | public java.lang.String getName() {
96 | java.lang.Object ref = name_;
97 | if (ref instanceof java.lang.String) {
98 | return (java.lang.String) ref;
99 | } else {
100 | com.google.protobuf.ByteString bs =
101 | (com.google.protobuf.ByteString) ref;
102 | java.lang.String s = bs.toStringUtf8();
103 | name_ = s;
104 | return s;
105 | }
106 | }
107 | /**
108 | * string name = 1;
109 | */
110 | public com.google.protobuf.ByteString
111 | getNameBytes() {
112 | java.lang.Object ref = name_;
113 | if (ref instanceof java.lang.String) {
114 | com.google.protobuf.ByteString b =
115 | com.google.protobuf.ByteString.copyFromUtf8(
116 | (java.lang.String) ref);
117 | name_ = b;
118 | return b;
119 | } else {
120 | return (com.google.protobuf.ByteString) ref;
121 | }
122 | }
123 |
124 | public static final int VALUE_FIELD_NUMBER = 2;
125 | private volatile java.lang.Object value_;
126 | /**
127 | * string value = 2;
128 | */
129 | public java.lang.String getValue() {
130 | java.lang.Object ref = value_;
131 | if (ref instanceof java.lang.String) {
132 | return (java.lang.String) ref;
133 | } else {
134 | com.google.protobuf.ByteString bs =
135 | (com.google.protobuf.ByteString) ref;
136 | java.lang.String s = bs.toStringUtf8();
137 | value_ = s;
138 | return s;
139 | }
140 | }
141 | /**
142 | * string value = 2;
143 | */
144 | public com.google.protobuf.ByteString
145 | getValueBytes() {
146 | java.lang.Object ref = value_;
147 | if (ref instanceof java.lang.String) {
148 | com.google.protobuf.ByteString b =
149 | com.google.protobuf.ByteString.copyFromUtf8(
150 | (java.lang.String) ref);
151 | value_ = b;
152 | return b;
153 | } else {
154 | return (com.google.protobuf.ByteString) ref;
155 | }
156 | }
157 |
158 | private byte memoizedIsInitialized = -1;
159 | public final boolean isInitialized() {
160 | byte isInitialized = memoizedIsInitialized;
161 | if (isInitialized == 1) return true;
162 | if (isInitialized == 0) return false;
163 |
164 | memoizedIsInitialized = 1;
165 | return true;
166 | }
167 |
168 | public void writeTo(com.google.protobuf.CodedOutputStream output)
169 | throws java.io.IOException {
170 | if (!getNameBytes().isEmpty()) {
171 | com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_);
172 | }
173 | if (!getValueBytes().isEmpty()) {
174 | com.google.protobuf.GeneratedMessageV3.writeString(output, 2, value_);
175 | }
176 | unknownFields.writeTo(output);
177 | }
178 |
179 | public int getSerializedSize() {
180 | int size = memoizedSize;
181 | if (size != -1) return size;
182 |
183 | size = 0;
184 | if (!getNameBytes().isEmpty()) {
185 | size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_);
186 | }
187 | if (!getValueBytes().isEmpty()) {
188 | size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, value_);
189 | }
190 | size += unknownFields.getSerializedSize();
191 | memoizedSize = size;
192 | return size;
193 | }
194 |
195 | @java.lang.Override
196 | public boolean equals(final java.lang.Object obj) {
197 | if (obj == this) {
198 | return true;
199 | }
200 | if (!(obj instanceof com.deep007.mitmproxyjava.MitmHeader)) {
201 | return super.equals(obj);
202 | }
203 | com.deep007.mitmproxyjava.MitmHeader other = (com.deep007.mitmproxyjava.MitmHeader) obj;
204 |
205 | boolean result = true;
206 | result = result && getName()
207 | .equals(other.getName());
208 | result = result && getValue()
209 | .equals(other.getValue());
210 | result = result && unknownFields.equals(other.unknownFields);
211 | return result;
212 | }
213 |
214 | @java.lang.Override
215 | public int hashCode() {
216 | if (memoizedHashCode != 0) {
217 | return memoizedHashCode;
218 | }
219 | int hash = 41;
220 | hash = (19 * hash) + getDescriptor().hashCode();
221 | hash = (37 * hash) + NAME_FIELD_NUMBER;
222 | hash = (53 * hash) + getName().hashCode();
223 | hash = (37 * hash) + VALUE_FIELD_NUMBER;
224 | hash = (53 * hash) + getValue().hashCode();
225 | hash = (29 * hash) + unknownFields.hashCode();
226 | memoizedHashCode = hash;
227 | return hash;
228 | }
229 |
230 | public static com.deep007.mitmproxyjava.MitmHeader parseFrom(
231 | java.nio.ByteBuffer data)
232 | throws com.google.protobuf.InvalidProtocolBufferException {
233 | return PARSER.parseFrom(data);
234 | }
235 | public static com.deep007.mitmproxyjava.MitmHeader parseFrom(
236 | java.nio.ByteBuffer data,
237 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
238 | throws com.google.protobuf.InvalidProtocolBufferException {
239 | return PARSER.parseFrom(data, extensionRegistry);
240 | }
241 | public static com.deep007.mitmproxyjava.MitmHeader parseFrom(
242 | com.google.protobuf.ByteString data)
243 | throws com.google.protobuf.InvalidProtocolBufferException {
244 | return PARSER.parseFrom(data);
245 | }
246 | public static com.deep007.mitmproxyjava.MitmHeader parseFrom(
247 | com.google.protobuf.ByteString data,
248 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
249 | throws com.google.protobuf.InvalidProtocolBufferException {
250 | return PARSER.parseFrom(data, extensionRegistry);
251 | }
252 | public static com.deep007.mitmproxyjava.MitmHeader parseFrom(byte[] data)
253 | throws com.google.protobuf.InvalidProtocolBufferException {
254 | return PARSER.parseFrom(data);
255 | }
256 | public static com.deep007.mitmproxyjava.MitmHeader parseFrom(
257 | byte[] data,
258 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
259 | throws com.google.protobuf.InvalidProtocolBufferException {
260 | return PARSER.parseFrom(data, extensionRegistry);
261 | }
262 | public static com.deep007.mitmproxyjava.MitmHeader parseFrom(java.io.InputStream input)
263 | throws java.io.IOException {
264 | return com.google.protobuf.GeneratedMessageV3
265 | .parseWithIOException(PARSER, input);
266 | }
267 | public static com.deep007.mitmproxyjava.MitmHeader parseFrom(
268 | java.io.InputStream input,
269 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
270 | throws java.io.IOException {
271 | return com.google.protobuf.GeneratedMessageV3
272 | .parseWithIOException(PARSER, input, extensionRegistry);
273 | }
274 | public static com.deep007.mitmproxyjava.MitmHeader parseDelimitedFrom(java.io.InputStream input)
275 | throws java.io.IOException {
276 | return com.google.protobuf.GeneratedMessageV3
277 | .parseDelimitedWithIOException(PARSER, input);
278 | }
279 | public static com.deep007.mitmproxyjava.MitmHeader parseDelimitedFrom(
280 | java.io.InputStream input,
281 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
282 | throws java.io.IOException {
283 | return com.google.protobuf.GeneratedMessageV3
284 | .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
285 | }
286 | public static com.deep007.mitmproxyjava.MitmHeader parseFrom(
287 | com.google.protobuf.CodedInputStream input)
288 | throws java.io.IOException {
289 | return com.google.protobuf.GeneratedMessageV3
290 | .parseWithIOException(PARSER, input);
291 | }
292 | public static com.deep007.mitmproxyjava.MitmHeader parseFrom(
293 | com.google.protobuf.CodedInputStream input,
294 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
295 | throws java.io.IOException {
296 | return com.google.protobuf.GeneratedMessageV3
297 | .parseWithIOException(PARSER, input, extensionRegistry);
298 | }
299 |
300 | public Builder newBuilderForType() { return newBuilder(); }
301 | public static Builder newBuilder() {
302 | return DEFAULT_INSTANCE.toBuilder();
303 | }
304 | public static Builder newBuilder(com.deep007.mitmproxyjava.MitmHeader prototype) {
305 | return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
306 | }
307 | public Builder toBuilder() {
308 | return this == DEFAULT_INSTANCE
309 | ? new Builder() : new Builder().mergeFrom(this);
310 | }
311 |
312 | @java.lang.Override
313 | protected Builder newBuilderForType(
314 | com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
315 | Builder builder = new Builder(parent);
316 | return builder;
317 | }
318 | /**
319 | * Protobuf type {@code mitm.MitmHeader}
320 | */
321 | public static final class Builder extends
322 | com.google.protobuf.GeneratedMessageV3.Builderstring name = 1;
461 | */
462 | public java.lang.String getName() {
463 | java.lang.Object ref = name_;
464 | if (!(ref instanceof java.lang.String)) {
465 | com.google.protobuf.ByteString bs =
466 | (com.google.protobuf.ByteString) ref;
467 | java.lang.String s = bs.toStringUtf8();
468 | name_ = s;
469 | return s;
470 | } else {
471 | return (java.lang.String) ref;
472 | }
473 | }
474 | /**
475 | * string name = 1;
476 | */
477 | public com.google.protobuf.ByteString
478 | getNameBytes() {
479 | java.lang.Object ref = name_;
480 | if (ref instanceof String) {
481 | com.google.protobuf.ByteString b =
482 | com.google.protobuf.ByteString.copyFromUtf8(
483 | (java.lang.String) ref);
484 | name_ = b;
485 | return b;
486 | } else {
487 | return (com.google.protobuf.ByteString) ref;
488 | }
489 | }
490 | /**
491 | * string name = 1;
492 | */
493 | public Builder setName(
494 | java.lang.String value) {
495 | if (value == null) {
496 | throw new NullPointerException();
497 | }
498 |
499 | name_ = value;
500 | onChanged();
501 | return this;
502 | }
503 | /**
504 | * string name = 1;
505 | */
506 | public Builder clearName() {
507 |
508 | name_ = getDefaultInstance().getName();
509 | onChanged();
510 | return this;
511 | }
512 | /**
513 | * string name = 1;
514 | */
515 | public Builder setNameBytes(
516 | com.google.protobuf.ByteString value) {
517 | if (value == null) {
518 | throw new NullPointerException();
519 | }
520 | checkByteStringIsUtf8(value);
521 |
522 | name_ = value;
523 | onChanged();
524 | return this;
525 | }
526 |
527 | private java.lang.Object value_ = "";
528 | /**
529 | * string value = 2;
530 | */
531 | public java.lang.String getValue() {
532 | java.lang.Object ref = value_;
533 | if (!(ref instanceof java.lang.String)) {
534 | com.google.protobuf.ByteString bs =
535 | (com.google.protobuf.ByteString) ref;
536 | java.lang.String s = bs.toStringUtf8();
537 | value_ = s;
538 | return s;
539 | } else {
540 | return (java.lang.String) ref;
541 | }
542 | }
543 | /**
544 | * string value = 2;
545 | */
546 | public com.google.protobuf.ByteString
547 | getValueBytes() {
548 | java.lang.Object ref = value_;
549 | if (ref instanceof String) {
550 | com.google.protobuf.ByteString b =
551 | com.google.protobuf.ByteString.copyFromUtf8(
552 | (java.lang.String) ref);
553 | value_ = b;
554 | return b;
555 | } else {
556 | return (com.google.protobuf.ByteString) ref;
557 | }
558 | }
559 | /**
560 | * string value = 2;
561 | */
562 | public Builder setValue(
563 | java.lang.String value) {
564 | if (value == null) {
565 | throw new NullPointerException();
566 | }
567 |
568 | value_ = value;
569 | onChanged();
570 | return this;
571 | }
572 | /**
573 | * string value = 2;
574 | */
575 | public Builder clearValue() {
576 |
577 | value_ = getDefaultInstance().getValue();
578 | onChanged();
579 | return this;
580 | }
581 | /**
582 | * string value = 2;
583 | */
584 | public Builder setValueBytes(
585 | com.google.protobuf.ByteString value) {
586 | if (value == null) {
587 | throw new NullPointerException();
588 | }
589 | checkByteStringIsUtf8(value);
590 |
591 | value_ = value;
592 | onChanged();
593 | return this;
594 | }
595 | public final Builder setUnknownFields(
596 | final com.google.protobuf.UnknownFieldSet unknownFields) {
597 | return super.setUnknownFieldsProto3(unknownFields);
598 | }
599 |
600 | public final Builder mergeUnknownFields(
601 | final com.google.protobuf.UnknownFieldSet unknownFields) {
602 | return super.mergeUnknownFields(unknownFields);
603 | }
604 |
605 |
606 | // @@protoc_insertion_point(builder_scope:mitm.MitmHeader)
607 | }
608 |
609 | // @@protoc_insertion_point(class_scope:mitm.MitmHeader)
610 | private static final com.deep007.mitmproxyjava.MitmHeader DEFAULT_INSTANCE;
611 | static {
612 | DEFAULT_INSTANCE = new com.deep007.mitmproxyjava.MitmHeader();
613 | }
614 |
615 | public static com.deep007.mitmproxyjava.MitmHeader getDefaultInstance() {
616 | return DEFAULT_INSTANCE;
617 | }
618 |
619 | private static final com.google.protobuf.Parserstring name = 1;
12 | */
13 | java.lang.String getName();
14 | /**
15 | * string name = 1;
16 | */
17 | com.google.protobuf.ByteString
18 | getNameBytes();
19 |
20 | /**
21 | * string value = 2;
22 | */
23 | java.lang.String getValue();
24 | /**
25 | * string value = 2;
26 | */
27 | com.google.protobuf.ByteString
28 | getValueBytes();
29 | }
30 |
--------------------------------------------------------------------------------
/src/main/java/com/deep007/mitmproxyjava/MitmProxyHubClientServerProto.java:
--------------------------------------------------------------------------------
1 | // Generated by the protocol buffer compiler. DO NOT EDIT!
2 | // source: mitm_hub_client.proto
3 |
4 | package com.deep007.mitmproxyjava;
5 |
6 | public final class MitmProxyHubClientServerProto {
7 | private MitmProxyHubClientServerProto() {}
8 | public static void registerAllExtensions(
9 | com.google.protobuf.ExtensionRegistryLite registry) {
10 | }
11 |
12 | public static void registerAllExtensions(
13 | com.google.protobuf.ExtensionRegistry registry) {
14 | registerAllExtensions(
15 | (com.google.protobuf.ExtensionRegistryLite) registry);
16 | }
17 | static final com.google.protobuf.Descriptors.Descriptor
18 | internal_static_mitm_VoidResponse_descriptor;
19 | static final
20 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
21 | internal_static_mitm_VoidResponse_fieldAccessorTable;
22 | static final com.google.protobuf.Descriptors.Descriptor
23 | internal_static_mitm_MitmproxyStartRequest_descriptor;
24 | static final
25 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
26 | internal_static_mitm_MitmproxyStartRequest_fieldAccessorTable;
27 | static final com.google.protobuf.Descriptors.Descriptor
28 | internal_static_mitm_MitmproxyStartResponse_descriptor;
29 | static final
30 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
31 | internal_static_mitm_MitmproxyStartResponse_fieldAccessorTable;
32 | static final com.google.protobuf.Descriptors.Descriptor
33 | internal_static_mitm_MitmproxyStopRequest_descriptor;
34 | static final
35 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
36 | internal_static_mitm_MitmproxyStopRequest_fieldAccessorTable;
37 | static final com.google.protobuf.Descriptors.Descriptor
38 | internal_static_mitm_MitmHeader_descriptor;
39 | static final
40 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
41 | internal_static_mitm_MitmHeader_fieldAccessorTable;
42 | static final com.google.protobuf.Descriptors.Descriptor
43 | internal_static_mitm_MitmRequest_descriptor;
44 | static final
45 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
46 | internal_static_mitm_MitmRequest_fieldAccessorTable;
47 | static final com.google.protobuf.Descriptors.Descriptor
48 | internal_static_mitm_MitmResponse_descriptor;
49 | static final
50 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
51 | internal_static_mitm_MitmResponse_fieldAccessorTable;
52 |
53 | public static com.google.protobuf.Descriptors.FileDescriptor
54 | getDescriptor() {
55 | return descriptor;
56 | }
57 | private static com.google.protobuf.Descriptors.FileDescriptor
58 | descriptor;
59 | static {
60 | java.lang.String[] descriptorData = {
61 | "\n\025mitm_hub_client.proto\022\004mitm\"\016\n\014VoidRes" +
62 | "ponse\"\223\001\n\025MitmproxyStartRequest\022\014\n\004bind\030" +
63 | "\001 \001(\t\022\014\n\004port\030\002 \001(\005\022\032\n\022callbackServerAdd" +
64 | "r\030\003 \001(\t\022\032\n\022callbackServerPort\030\004 \001(\005\022\020\n\010u" +
65 | "pstream\030\005 \001(\t\022\024\n\014upstreamAuth\030\006 \001(\t\"-\n\026M" +
66 | "itmproxyStartResponse\022\023\n\013mitmproxyId\030\001 \001" +
67 | "(\t\"+\n\024MitmproxyStopRequest\022\023\n\013mitmproxyI" +
68 | "d\030\001 \001(\t\")\n\nMitmHeader\022\014\n\004name\030\001 \001(\t\022\r\n\005v" +
69 | "alue\030\002 \001(\t\"s\n\013MitmRequest\022\013\n\003url\030\001 \001(\t\022\016" +
70 | "\n\006method\030\002 \001(\t\022!\n\007headers\030\003 \003(\0132\020.mitm.M" +
71 | "itmHeader\022\017\n\007content\030\004 \001(\014\022\023\n\013mitmproxyI" +
72 | "d\030\005 \001(\t\"\217\001\n\014MitmResponse\022\"\n\007request\030\001 \001(" +
73 | "\0132\021.mitm.MitmRequest\022!\n\007headers\030\002 \003(\0132\020." +
74 | "mitm.MitmHeader\022\017\n\007content\030\003 \001(\014\022\022\n\nstat" +
75 | "usCode\030\004 \001(\005\022\023\n\013mitmproxyId\030\005 \001(\t2\224\001\n\022Mi" +
76 | "tmProxyHubServer\022D\n\005start\022\033.mitm.Mitmpro" +
77 | "xyStartRequest\032\034.mitm.MitmproxyStartResp" +
78 | "onse\"\000\0228\n\004stop\022\032.mitm.MitmproxyStopReque" +
79 | "st\032\022.mitm.VoidResponse\"\0002\217\001\n\030MitmProxyHu" +
80 | "bClientServer\0227\n\ronMitmRequest\022\021.mitm.Mi" +
81 | "tmRequest\032\021.mitm.MitmRequest\"\000\022:\n\016onMitm" +
82 | "Response\022\022.mitm.MitmResponse\032\022.mitm.Mitm" +
83 | "Response\"\000B<\n\031com.deep007.mitmproxyjavaB" +
84 | "\035MitmProxyHubClientServerProtoP\001b\006proto3"
85 | };
86 | com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
87 | new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
88 | public com.google.protobuf.ExtensionRegistry assignDescriptors(
89 | com.google.protobuf.Descriptors.FileDescriptor root) {
90 | descriptor = root;
91 | return null;
92 | }
93 | };
94 | com.google.protobuf.Descriptors.FileDescriptor
95 | .internalBuildGeneratedFileFrom(descriptorData,
96 | new com.google.protobuf.Descriptors.FileDescriptor[] {
97 | }, assigner);
98 | internal_static_mitm_VoidResponse_descriptor =
99 | getDescriptor().getMessageTypes().get(0);
100 | internal_static_mitm_VoidResponse_fieldAccessorTable = new
101 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
102 | internal_static_mitm_VoidResponse_descriptor,
103 | new java.lang.String[] { });
104 | internal_static_mitm_MitmproxyStartRequest_descriptor =
105 | getDescriptor().getMessageTypes().get(1);
106 | internal_static_mitm_MitmproxyStartRequest_fieldAccessorTable = new
107 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
108 | internal_static_mitm_MitmproxyStartRequest_descriptor,
109 | new java.lang.String[] { "Bind", "Port", "CallbackServerAddr", "CallbackServerPort", "Upstream", "UpstreamAuth", });
110 | internal_static_mitm_MitmproxyStartResponse_descriptor =
111 | getDescriptor().getMessageTypes().get(2);
112 | internal_static_mitm_MitmproxyStartResponse_fieldAccessorTable = new
113 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
114 | internal_static_mitm_MitmproxyStartResponse_descriptor,
115 | new java.lang.String[] { "MitmproxyId", });
116 | internal_static_mitm_MitmproxyStopRequest_descriptor =
117 | getDescriptor().getMessageTypes().get(3);
118 | internal_static_mitm_MitmproxyStopRequest_fieldAccessorTable = new
119 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
120 | internal_static_mitm_MitmproxyStopRequest_descriptor,
121 | new java.lang.String[] { "MitmproxyId", });
122 | internal_static_mitm_MitmHeader_descriptor =
123 | getDescriptor().getMessageTypes().get(4);
124 | internal_static_mitm_MitmHeader_fieldAccessorTable = new
125 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
126 | internal_static_mitm_MitmHeader_descriptor,
127 | new java.lang.String[] { "Name", "Value", });
128 | internal_static_mitm_MitmRequest_descriptor =
129 | getDescriptor().getMessageTypes().get(5);
130 | internal_static_mitm_MitmRequest_fieldAccessorTable = new
131 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
132 | internal_static_mitm_MitmRequest_descriptor,
133 | new java.lang.String[] { "Url", "Method", "Headers", "Content", "MitmproxyId", });
134 | internal_static_mitm_MitmResponse_descriptor =
135 | getDescriptor().getMessageTypes().get(6);
136 | internal_static_mitm_MitmResponse_fieldAccessorTable = new
137 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
138 | internal_static_mitm_MitmResponse_descriptor,
139 | new java.lang.String[] { "Request", "Headers", "Content", "StatusCode", "MitmproxyId", });
140 | }
141 |
142 | // @@protoc_insertion_point(outer_class_scope)
143 | }
144 |
--------------------------------------------------------------------------------
/src/main/java/com/deep007/mitmproxyjava/MitmRequestOrBuilder.java:
--------------------------------------------------------------------------------
1 | // Generated by the protocol buffer compiler. DO NOT EDIT!
2 | // source: mitm_hub_client.proto
3 |
4 | package com.deep007.mitmproxyjava;
5 |
6 | public interface MitmRequestOrBuilder extends
7 | // @@protoc_insertion_point(interface_extends:mitm.MitmRequest)
8 | com.google.protobuf.MessageOrBuilder {
9 |
10 | /**
11 | * string url = 1;
12 | */
13 | java.lang.String getUrl();
14 | /**
15 | * string url = 1;
16 | */
17 | com.google.protobuf.ByteString
18 | getUrlBytes();
19 |
20 | /**
21 | * string method = 2;
22 | */
23 | java.lang.String getMethod();
24 | /**
25 | * string method = 2;
26 | */
27 | com.google.protobuf.ByteString
28 | getMethodBytes();
29 |
30 | /**
31 | * repeated .mitm.MitmHeader headers = 3;
32 | */
33 | java.util.Listrepeated .mitm.MitmHeader headers = 3;
37 | */
38 | com.deep007.mitmproxyjava.MitmHeader getHeaders(int index);
39 | /**
40 | * repeated .mitm.MitmHeader headers = 3;
41 | */
42 | int getHeadersCount();
43 | /**
44 | * repeated .mitm.MitmHeader headers = 3;
45 | */
46 | java.util.List extends com.deep007.mitmproxyjava.MitmHeaderOrBuilder>
47 | getHeadersOrBuilderList();
48 | /**
49 | * repeated .mitm.MitmHeader headers = 3;
50 | */
51 | com.deep007.mitmproxyjava.MitmHeaderOrBuilder getHeadersOrBuilder(
52 | int index);
53 |
54 | /**
55 | * bytes content = 4;
56 | */
57 | com.google.protobuf.ByteString getContent();
58 |
59 | /**
60 | * string mitmproxyId = 5;
61 | */
62 | java.lang.String getMitmproxyId();
63 | /**
64 | * string mitmproxyId = 5;
65 | */
66 | com.google.protobuf.ByteString
67 | getMitmproxyIdBytes();
68 | }
69 |
--------------------------------------------------------------------------------
/src/main/java/com/deep007/mitmproxyjava/MitmResponseOrBuilder.java:
--------------------------------------------------------------------------------
1 | // Generated by the protocol buffer compiler. DO NOT EDIT!
2 | // source: mitm_hub_client.proto
3 |
4 | package com.deep007.mitmproxyjava;
5 |
6 | public interface MitmResponseOrBuilder extends
7 | // @@protoc_insertion_point(interface_extends:mitm.MitmResponse)
8 | com.google.protobuf.MessageOrBuilder {
9 |
10 | /**
11 | * .mitm.MitmRequest request = 1;
12 | */
13 | boolean hasRequest();
14 | /**
15 | * .mitm.MitmRequest request = 1;
16 | */
17 | com.deep007.mitmproxyjava.MitmRequest getRequest();
18 | /**
19 | * .mitm.MitmRequest request = 1;
20 | */
21 | com.deep007.mitmproxyjava.MitmRequestOrBuilder getRequestOrBuilder();
22 |
23 | /**
24 | * repeated .mitm.MitmHeader headers = 2;
25 | */
26 | java.util.Listrepeated .mitm.MitmHeader headers = 2;
30 | */
31 | com.deep007.mitmproxyjava.MitmHeader getHeaders(int index);
32 | /**
33 | * repeated .mitm.MitmHeader headers = 2;
34 | */
35 | int getHeadersCount();
36 | /**
37 | * repeated .mitm.MitmHeader headers = 2;
38 | */
39 | java.util.List extends com.deep007.mitmproxyjava.MitmHeaderOrBuilder>
40 | getHeadersOrBuilderList();
41 | /**
42 | * repeated .mitm.MitmHeader headers = 2;
43 | */
44 | com.deep007.mitmproxyjava.MitmHeaderOrBuilder getHeadersOrBuilder(
45 | int index);
46 |
47 | /**
48 | * bytes content = 3;
49 | */
50 | com.google.protobuf.ByteString getContent();
51 |
52 | /**
53 | * int32 statusCode = 4;
54 | */
55 | int getStatusCode();
56 |
57 | /**
58 | * string mitmproxyId = 5;
59 | */
60 | java.lang.String getMitmproxyId();
61 | /**
62 | * string mitmproxyId = 5;
63 | */
64 | com.google.protobuf.ByteString
65 | getMitmproxyIdBytes();
66 | }
67 |
--------------------------------------------------------------------------------
/src/main/java/com/deep007/mitmproxyjava/MitmproxyStartRequest.java:
--------------------------------------------------------------------------------
1 | // Generated by the protocol buffer compiler. DO NOT EDIT!
2 | // source: mitm_hub_client.proto
3 |
4 | package com.deep007.mitmproxyjava;
5 |
6 | /**
7 | * Protobuf type {@code mitm.MitmproxyStartRequest}
8 | */
9 | public final class MitmproxyStartRequest extends
10 | com.google.protobuf.GeneratedMessageV3 implements
11 | // @@protoc_insertion_point(message_implements:mitm.MitmproxyStartRequest)
12 | MitmproxyStartRequestOrBuilder {
13 | private static final long serialVersionUID = 0L;
14 | // Use MitmproxyStartRequest.newBuilder() to construct.
15 | private MitmproxyStartRequest(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
16 | super(builder);
17 | }
18 | private MitmproxyStartRequest() {
19 | bind_ = "";
20 | port_ = 0;
21 | callbackServerAddr_ = "";
22 | callbackServerPort_ = 0;
23 | upstream_ = "";
24 | upstreamAuth_ = "";
25 | }
26 |
27 | @java.lang.Override
28 | public final com.google.protobuf.UnknownFieldSet
29 | getUnknownFields() {
30 | return this.unknownFields;
31 | }
32 | private MitmproxyStartRequest(
33 | com.google.protobuf.CodedInputStream input,
34 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
35 | throws com.google.protobuf.InvalidProtocolBufferException {
36 | this();
37 | if (extensionRegistry == null) {
38 | throw new java.lang.NullPointerException();
39 | }
40 | int mutable_bitField0_ = 0;
41 | com.google.protobuf.UnknownFieldSet.Builder unknownFields =
42 | com.google.protobuf.UnknownFieldSet.newBuilder();
43 | try {
44 | boolean done = false;
45 | while (!done) {
46 | int tag = input.readTag();
47 | switch (tag) {
48 | case 0:
49 | done = true;
50 | break;
51 | default: {
52 | if (!parseUnknownFieldProto3(
53 | input, unknownFields, extensionRegistry, tag)) {
54 | done = true;
55 | }
56 | break;
57 | }
58 | case 10: {
59 | java.lang.String s = input.readStringRequireUtf8();
60 |
61 | bind_ = s;
62 | break;
63 | }
64 | case 16: {
65 |
66 | port_ = input.readInt32();
67 | break;
68 | }
69 | case 26: {
70 | java.lang.String s = input.readStringRequireUtf8();
71 |
72 | callbackServerAddr_ = s;
73 | break;
74 | }
75 | case 32: {
76 |
77 | callbackServerPort_ = input.readInt32();
78 | break;
79 | }
80 | case 42: {
81 | java.lang.String s = input.readStringRequireUtf8();
82 |
83 | upstream_ = s;
84 | break;
85 | }
86 | case 50: {
87 | java.lang.String s = input.readStringRequireUtf8();
88 |
89 | upstreamAuth_ = s;
90 | break;
91 | }
92 | }
93 | }
94 | } catch (com.google.protobuf.InvalidProtocolBufferException e) {
95 | throw e.setUnfinishedMessage(this);
96 | } catch (java.io.IOException e) {
97 | throw new com.google.protobuf.InvalidProtocolBufferException(
98 | e).setUnfinishedMessage(this);
99 | } finally {
100 | this.unknownFields = unknownFields.build();
101 | makeExtensionsImmutable();
102 | }
103 | }
104 | public static final com.google.protobuf.Descriptors.Descriptor
105 | getDescriptor() {
106 | return com.deep007.mitmproxyjava.MitmProxyHubClientServerProto.internal_static_mitm_MitmproxyStartRequest_descriptor;
107 | }
108 |
109 | protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
110 | internalGetFieldAccessorTable() {
111 | return com.deep007.mitmproxyjava.MitmProxyHubClientServerProto.internal_static_mitm_MitmproxyStartRequest_fieldAccessorTable
112 | .ensureFieldAccessorsInitialized(
113 | com.deep007.mitmproxyjava.MitmproxyStartRequest.class, com.deep007.mitmproxyjava.MitmproxyStartRequest.Builder.class);
114 | }
115 |
116 | public static final int BIND_FIELD_NUMBER = 1;
117 | private volatile java.lang.Object bind_;
118 | /**
119 | * string bind = 1;
120 | */
121 | public java.lang.String getBind() {
122 | java.lang.Object ref = bind_;
123 | if (ref instanceof java.lang.String) {
124 | return (java.lang.String) ref;
125 | } else {
126 | com.google.protobuf.ByteString bs =
127 | (com.google.protobuf.ByteString) ref;
128 | java.lang.String s = bs.toStringUtf8();
129 | bind_ = s;
130 | return s;
131 | }
132 | }
133 | /**
134 | * string bind = 1;
135 | */
136 | public com.google.protobuf.ByteString
137 | getBindBytes() {
138 | java.lang.Object ref = bind_;
139 | if (ref instanceof java.lang.String) {
140 | com.google.protobuf.ByteString b =
141 | com.google.protobuf.ByteString.copyFromUtf8(
142 | (java.lang.String) ref);
143 | bind_ = b;
144 | return b;
145 | } else {
146 | return (com.google.protobuf.ByteString) ref;
147 | }
148 | }
149 |
150 | public static final int PORT_FIELD_NUMBER = 2;
151 | private int port_;
152 | /**
153 | * int32 port = 2;
154 | */
155 | public int getPort() {
156 | return port_;
157 | }
158 |
159 | public static final int CALLBACKSERVERADDR_FIELD_NUMBER = 3;
160 | private volatile java.lang.Object callbackServerAddr_;
161 | /**
162 | * string callbackServerAddr = 3;
163 | */
164 | public java.lang.String getCallbackServerAddr() {
165 | java.lang.Object ref = callbackServerAddr_;
166 | if (ref instanceof java.lang.String) {
167 | return (java.lang.String) ref;
168 | } else {
169 | com.google.protobuf.ByteString bs =
170 | (com.google.protobuf.ByteString) ref;
171 | java.lang.String s = bs.toStringUtf8();
172 | callbackServerAddr_ = s;
173 | return s;
174 | }
175 | }
176 | /**
177 | * string callbackServerAddr = 3;
178 | */
179 | public com.google.protobuf.ByteString
180 | getCallbackServerAddrBytes() {
181 | java.lang.Object ref = callbackServerAddr_;
182 | if (ref instanceof java.lang.String) {
183 | com.google.protobuf.ByteString b =
184 | com.google.protobuf.ByteString.copyFromUtf8(
185 | (java.lang.String) ref);
186 | callbackServerAddr_ = b;
187 | return b;
188 | } else {
189 | return (com.google.protobuf.ByteString) ref;
190 | }
191 | }
192 |
193 | public static final int CALLBACKSERVERPORT_FIELD_NUMBER = 4;
194 | private int callbackServerPort_;
195 | /**
196 | * int32 callbackServerPort = 4;
197 | */
198 | public int getCallbackServerPort() {
199 | return callbackServerPort_;
200 | }
201 |
202 | public static final int UPSTREAM_FIELD_NUMBER = 5;
203 | private volatile java.lang.Object upstream_;
204 | /**
205 | * string upstream = 5;
206 | */
207 | public java.lang.String getUpstream() {
208 | java.lang.Object ref = upstream_;
209 | if (ref instanceof java.lang.String) {
210 | return (java.lang.String) ref;
211 | } else {
212 | com.google.protobuf.ByteString bs =
213 | (com.google.protobuf.ByteString) ref;
214 | java.lang.String s = bs.toStringUtf8();
215 | upstream_ = s;
216 | return s;
217 | }
218 | }
219 | /**
220 | * string upstream = 5;
221 | */
222 | public com.google.protobuf.ByteString
223 | getUpstreamBytes() {
224 | java.lang.Object ref = upstream_;
225 | if (ref instanceof java.lang.String) {
226 | com.google.protobuf.ByteString b =
227 | com.google.protobuf.ByteString.copyFromUtf8(
228 | (java.lang.String) ref);
229 | upstream_ = b;
230 | return b;
231 | } else {
232 | return (com.google.protobuf.ByteString) ref;
233 | }
234 | }
235 |
236 | public static final int UPSTREAMAUTH_FIELD_NUMBER = 6;
237 | private volatile java.lang.Object upstreamAuth_;
238 | /**
239 | * string upstreamAuth = 6;
240 | */
241 | public java.lang.String getUpstreamAuth() {
242 | java.lang.Object ref = upstreamAuth_;
243 | if (ref instanceof java.lang.String) {
244 | return (java.lang.String) ref;
245 | } else {
246 | com.google.protobuf.ByteString bs =
247 | (com.google.protobuf.ByteString) ref;
248 | java.lang.String s = bs.toStringUtf8();
249 | upstreamAuth_ = s;
250 | return s;
251 | }
252 | }
253 | /**
254 | * string upstreamAuth = 6;
255 | */
256 | public com.google.protobuf.ByteString
257 | getUpstreamAuthBytes() {
258 | java.lang.Object ref = upstreamAuth_;
259 | if (ref instanceof java.lang.String) {
260 | com.google.protobuf.ByteString b =
261 | com.google.protobuf.ByteString.copyFromUtf8(
262 | (java.lang.String) ref);
263 | upstreamAuth_ = b;
264 | return b;
265 | } else {
266 | return (com.google.protobuf.ByteString) ref;
267 | }
268 | }
269 |
270 | private byte memoizedIsInitialized = -1;
271 | public final boolean isInitialized() {
272 | byte isInitialized = memoizedIsInitialized;
273 | if (isInitialized == 1) return true;
274 | if (isInitialized == 0) return false;
275 |
276 | memoizedIsInitialized = 1;
277 | return true;
278 | }
279 |
280 | public void writeTo(com.google.protobuf.CodedOutputStream output)
281 | throws java.io.IOException {
282 | if (!getBindBytes().isEmpty()) {
283 | com.google.protobuf.GeneratedMessageV3.writeString(output, 1, bind_);
284 | }
285 | if (port_ != 0) {
286 | output.writeInt32(2, port_);
287 | }
288 | if (!getCallbackServerAddrBytes().isEmpty()) {
289 | com.google.protobuf.GeneratedMessageV3.writeString(output, 3, callbackServerAddr_);
290 | }
291 | if (callbackServerPort_ != 0) {
292 | output.writeInt32(4, callbackServerPort_);
293 | }
294 | if (!getUpstreamBytes().isEmpty()) {
295 | com.google.protobuf.GeneratedMessageV3.writeString(output, 5, upstream_);
296 | }
297 | if (!getUpstreamAuthBytes().isEmpty()) {
298 | com.google.protobuf.GeneratedMessageV3.writeString(output, 6, upstreamAuth_);
299 | }
300 | unknownFields.writeTo(output);
301 | }
302 |
303 | public int getSerializedSize() {
304 | int size = memoizedSize;
305 | if (size != -1) return size;
306 |
307 | size = 0;
308 | if (!getBindBytes().isEmpty()) {
309 | size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, bind_);
310 | }
311 | if (port_ != 0) {
312 | size += com.google.protobuf.CodedOutputStream
313 | .computeInt32Size(2, port_);
314 | }
315 | if (!getCallbackServerAddrBytes().isEmpty()) {
316 | size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, callbackServerAddr_);
317 | }
318 | if (callbackServerPort_ != 0) {
319 | size += com.google.protobuf.CodedOutputStream
320 | .computeInt32Size(4, callbackServerPort_);
321 | }
322 | if (!getUpstreamBytes().isEmpty()) {
323 | size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, upstream_);
324 | }
325 | if (!getUpstreamAuthBytes().isEmpty()) {
326 | size += com.google.protobuf.GeneratedMessageV3.computeStringSize(6, upstreamAuth_);
327 | }
328 | size += unknownFields.getSerializedSize();
329 | memoizedSize = size;
330 | return size;
331 | }
332 |
333 | @java.lang.Override
334 | public boolean equals(final java.lang.Object obj) {
335 | if (obj == this) {
336 | return true;
337 | }
338 | if (!(obj instanceof com.deep007.mitmproxyjava.MitmproxyStartRequest)) {
339 | return super.equals(obj);
340 | }
341 | com.deep007.mitmproxyjava.MitmproxyStartRequest other = (com.deep007.mitmproxyjava.MitmproxyStartRequest) obj;
342 |
343 | boolean result = true;
344 | result = result && getBind()
345 | .equals(other.getBind());
346 | result = result && (getPort()
347 | == other.getPort());
348 | result = result && getCallbackServerAddr()
349 | .equals(other.getCallbackServerAddr());
350 | result = result && (getCallbackServerPort()
351 | == other.getCallbackServerPort());
352 | result = result && getUpstream()
353 | .equals(other.getUpstream());
354 | result = result && getUpstreamAuth()
355 | .equals(other.getUpstreamAuth());
356 | result = result && unknownFields.equals(other.unknownFields);
357 | return result;
358 | }
359 |
360 | @java.lang.Override
361 | public int hashCode() {
362 | if (memoizedHashCode != 0) {
363 | return memoizedHashCode;
364 | }
365 | int hash = 41;
366 | hash = (19 * hash) + getDescriptor().hashCode();
367 | hash = (37 * hash) + BIND_FIELD_NUMBER;
368 | hash = (53 * hash) + getBind().hashCode();
369 | hash = (37 * hash) + PORT_FIELD_NUMBER;
370 | hash = (53 * hash) + getPort();
371 | hash = (37 * hash) + CALLBACKSERVERADDR_FIELD_NUMBER;
372 | hash = (53 * hash) + getCallbackServerAddr().hashCode();
373 | hash = (37 * hash) + CALLBACKSERVERPORT_FIELD_NUMBER;
374 | hash = (53 * hash) + getCallbackServerPort();
375 | hash = (37 * hash) + UPSTREAM_FIELD_NUMBER;
376 | hash = (53 * hash) + getUpstream().hashCode();
377 | hash = (37 * hash) + UPSTREAMAUTH_FIELD_NUMBER;
378 | hash = (53 * hash) + getUpstreamAuth().hashCode();
379 | hash = (29 * hash) + unknownFields.hashCode();
380 | memoizedHashCode = hash;
381 | return hash;
382 | }
383 |
384 | public static com.deep007.mitmproxyjava.MitmproxyStartRequest parseFrom(
385 | java.nio.ByteBuffer data)
386 | throws com.google.protobuf.InvalidProtocolBufferException {
387 | return PARSER.parseFrom(data);
388 | }
389 | public static com.deep007.mitmproxyjava.MitmproxyStartRequest parseFrom(
390 | java.nio.ByteBuffer data,
391 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
392 | throws com.google.protobuf.InvalidProtocolBufferException {
393 | return PARSER.parseFrom(data, extensionRegistry);
394 | }
395 | public static com.deep007.mitmproxyjava.MitmproxyStartRequest parseFrom(
396 | com.google.protobuf.ByteString data)
397 | throws com.google.protobuf.InvalidProtocolBufferException {
398 | return PARSER.parseFrom(data);
399 | }
400 | public static com.deep007.mitmproxyjava.MitmproxyStartRequest parseFrom(
401 | com.google.protobuf.ByteString data,
402 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
403 | throws com.google.protobuf.InvalidProtocolBufferException {
404 | return PARSER.parseFrom(data, extensionRegistry);
405 | }
406 | public static com.deep007.mitmproxyjava.MitmproxyStartRequest parseFrom(byte[] data)
407 | throws com.google.protobuf.InvalidProtocolBufferException {
408 | return PARSER.parseFrom(data);
409 | }
410 | public static com.deep007.mitmproxyjava.MitmproxyStartRequest parseFrom(
411 | byte[] data,
412 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
413 | throws com.google.protobuf.InvalidProtocolBufferException {
414 | return PARSER.parseFrom(data, extensionRegistry);
415 | }
416 | public static com.deep007.mitmproxyjava.MitmproxyStartRequest parseFrom(java.io.InputStream input)
417 | throws java.io.IOException {
418 | return com.google.protobuf.GeneratedMessageV3
419 | .parseWithIOException(PARSER, input);
420 | }
421 | public static com.deep007.mitmproxyjava.MitmproxyStartRequest parseFrom(
422 | java.io.InputStream input,
423 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
424 | throws java.io.IOException {
425 | return com.google.protobuf.GeneratedMessageV3
426 | .parseWithIOException(PARSER, input, extensionRegistry);
427 | }
428 | public static com.deep007.mitmproxyjava.MitmproxyStartRequest parseDelimitedFrom(java.io.InputStream input)
429 | throws java.io.IOException {
430 | return com.google.protobuf.GeneratedMessageV3
431 | .parseDelimitedWithIOException(PARSER, input);
432 | }
433 | public static com.deep007.mitmproxyjava.MitmproxyStartRequest parseDelimitedFrom(
434 | java.io.InputStream input,
435 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
436 | throws java.io.IOException {
437 | return com.google.protobuf.GeneratedMessageV3
438 | .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
439 | }
440 | public static com.deep007.mitmproxyjava.MitmproxyStartRequest parseFrom(
441 | com.google.protobuf.CodedInputStream input)
442 | throws java.io.IOException {
443 | return com.google.protobuf.GeneratedMessageV3
444 | .parseWithIOException(PARSER, input);
445 | }
446 | public static com.deep007.mitmproxyjava.MitmproxyStartRequest parseFrom(
447 | com.google.protobuf.CodedInputStream input,
448 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
449 | throws java.io.IOException {
450 | return com.google.protobuf.GeneratedMessageV3
451 | .parseWithIOException(PARSER, input, extensionRegistry);
452 | }
453 |
454 | public Builder newBuilderForType() { return newBuilder(); }
455 | public static Builder newBuilder() {
456 | return DEFAULT_INSTANCE.toBuilder();
457 | }
458 | public static Builder newBuilder(com.deep007.mitmproxyjava.MitmproxyStartRequest prototype) {
459 | return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
460 | }
461 | public Builder toBuilder() {
462 | return this == DEFAULT_INSTANCE
463 | ? new Builder() : new Builder().mergeFrom(this);
464 | }
465 |
466 | @java.lang.Override
467 | protected Builder newBuilderForType(
468 | com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
469 | Builder builder = new Builder(parent);
470 | return builder;
471 | }
472 | /**
473 | * Protobuf type {@code mitm.MitmproxyStartRequest}
474 | */
475 | public static final class Builder extends
476 | com.google.protobuf.GeneratedMessageV3.Builderstring bind = 1;
641 | */
642 | public java.lang.String getBind() {
643 | java.lang.Object ref = bind_;
644 | if (!(ref instanceof java.lang.String)) {
645 | com.google.protobuf.ByteString bs =
646 | (com.google.protobuf.ByteString) ref;
647 | java.lang.String s = bs.toStringUtf8();
648 | bind_ = s;
649 | return s;
650 | } else {
651 | return (java.lang.String) ref;
652 | }
653 | }
654 | /**
655 | * string bind = 1;
656 | */
657 | public com.google.protobuf.ByteString
658 | getBindBytes() {
659 | java.lang.Object ref = bind_;
660 | if (ref instanceof String) {
661 | com.google.protobuf.ByteString b =
662 | com.google.protobuf.ByteString.copyFromUtf8(
663 | (java.lang.String) ref);
664 | bind_ = b;
665 | return b;
666 | } else {
667 | return (com.google.protobuf.ByteString) ref;
668 | }
669 | }
670 | /**
671 | * string bind = 1;
672 | */
673 | public Builder setBind(
674 | java.lang.String value) {
675 | if (value == null) {
676 | throw new NullPointerException();
677 | }
678 |
679 | bind_ = value;
680 | onChanged();
681 | return this;
682 | }
683 | /**
684 | * string bind = 1;
685 | */
686 | public Builder clearBind() {
687 |
688 | bind_ = getDefaultInstance().getBind();
689 | onChanged();
690 | return this;
691 | }
692 | /**
693 | * string bind = 1;
694 | */
695 | public Builder setBindBytes(
696 | com.google.protobuf.ByteString value) {
697 | if (value == null) {
698 | throw new NullPointerException();
699 | }
700 | checkByteStringIsUtf8(value);
701 |
702 | bind_ = value;
703 | onChanged();
704 | return this;
705 | }
706 |
707 | private int port_ ;
708 | /**
709 | * int32 port = 2;
710 | */
711 | public int getPort() {
712 | return port_;
713 | }
714 | /**
715 | * int32 port = 2;
716 | */
717 | public Builder setPort(int value) {
718 |
719 | port_ = value;
720 | onChanged();
721 | return this;
722 | }
723 | /**
724 | * int32 port = 2;
725 | */
726 | public Builder clearPort() {
727 |
728 | port_ = 0;
729 | onChanged();
730 | return this;
731 | }
732 |
733 | private java.lang.Object callbackServerAddr_ = "";
734 | /**
735 | * string callbackServerAddr = 3;
736 | */
737 | public java.lang.String getCallbackServerAddr() {
738 | java.lang.Object ref = callbackServerAddr_;
739 | if (!(ref instanceof java.lang.String)) {
740 | com.google.protobuf.ByteString bs =
741 | (com.google.protobuf.ByteString) ref;
742 | java.lang.String s = bs.toStringUtf8();
743 | callbackServerAddr_ = s;
744 | return s;
745 | } else {
746 | return (java.lang.String) ref;
747 | }
748 | }
749 | /**
750 | * string callbackServerAddr = 3;
751 | */
752 | public com.google.protobuf.ByteString
753 | getCallbackServerAddrBytes() {
754 | java.lang.Object ref = callbackServerAddr_;
755 | if (ref instanceof String) {
756 | com.google.protobuf.ByteString b =
757 | com.google.protobuf.ByteString.copyFromUtf8(
758 | (java.lang.String) ref);
759 | callbackServerAddr_ = b;
760 | return b;
761 | } else {
762 | return (com.google.protobuf.ByteString) ref;
763 | }
764 | }
765 | /**
766 | * string callbackServerAddr = 3;
767 | */
768 | public Builder setCallbackServerAddr(
769 | java.lang.String value) {
770 | if (value == null) {
771 | throw new NullPointerException();
772 | }
773 |
774 | callbackServerAddr_ = value;
775 | onChanged();
776 | return this;
777 | }
778 | /**
779 | * string callbackServerAddr = 3;
780 | */
781 | public Builder clearCallbackServerAddr() {
782 |
783 | callbackServerAddr_ = getDefaultInstance().getCallbackServerAddr();
784 | onChanged();
785 | return this;
786 | }
787 | /**
788 | * string callbackServerAddr = 3;
789 | */
790 | public Builder setCallbackServerAddrBytes(
791 | com.google.protobuf.ByteString value) {
792 | if (value == null) {
793 | throw new NullPointerException();
794 | }
795 | checkByteStringIsUtf8(value);
796 |
797 | callbackServerAddr_ = value;
798 | onChanged();
799 | return this;
800 | }
801 |
802 | private int callbackServerPort_ ;
803 | /**
804 | * int32 callbackServerPort = 4;
805 | */
806 | public int getCallbackServerPort() {
807 | return callbackServerPort_;
808 | }
809 | /**
810 | * int32 callbackServerPort = 4;
811 | */
812 | public Builder setCallbackServerPort(int value) {
813 |
814 | callbackServerPort_ = value;
815 | onChanged();
816 | return this;
817 | }
818 | /**
819 | * int32 callbackServerPort = 4;
820 | */
821 | public Builder clearCallbackServerPort() {
822 |
823 | callbackServerPort_ = 0;
824 | onChanged();
825 | return this;
826 | }
827 |
828 | private java.lang.Object upstream_ = "";
829 | /**
830 | * string upstream = 5;
831 | */
832 | public java.lang.String getUpstream() {
833 | java.lang.Object ref = upstream_;
834 | if (!(ref instanceof java.lang.String)) {
835 | com.google.protobuf.ByteString bs =
836 | (com.google.protobuf.ByteString) ref;
837 | java.lang.String s = bs.toStringUtf8();
838 | upstream_ = s;
839 | return s;
840 | } else {
841 | return (java.lang.String) ref;
842 | }
843 | }
844 | /**
845 | * string upstream = 5;
846 | */
847 | public com.google.protobuf.ByteString
848 | getUpstreamBytes() {
849 | java.lang.Object ref = upstream_;
850 | if (ref instanceof String) {
851 | com.google.protobuf.ByteString b =
852 | com.google.protobuf.ByteString.copyFromUtf8(
853 | (java.lang.String) ref);
854 | upstream_ = b;
855 | return b;
856 | } else {
857 | return (com.google.protobuf.ByteString) ref;
858 | }
859 | }
860 | /**
861 | * string upstream = 5;
862 | */
863 | public Builder setUpstream(
864 | java.lang.String value) {
865 | if (value == null) {
866 | throw new NullPointerException();
867 | }
868 |
869 | upstream_ = value;
870 | onChanged();
871 | return this;
872 | }
873 | /**
874 | * string upstream = 5;
875 | */
876 | public Builder clearUpstream() {
877 |
878 | upstream_ = getDefaultInstance().getUpstream();
879 | onChanged();
880 | return this;
881 | }
882 | /**
883 | * string upstream = 5;
884 | */
885 | public Builder setUpstreamBytes(
886 | com.google.protobuf.ByteString value) {
887 | if (value == null) {
888 | throw new NullPointerException();
889 | }
890 | checkByteStringIsUtf8(value);
891 |
892 | upstream_ = value;
893 | onChanged();
894 | return this;
895 | }
896 |
897 | private java.lang.Object upstreamAuth_ = "";
898 | /**
899 | * string upstreamAuth = 6;
900 | */
901 | public java.lang.String getUpstreamAuth() {
902 | java.lang.Object ref = upstreamAuth_;
903 | if (!(ref instanceof java.lang.String)) {
904 | com.google.protobuf.ByteString bs =
905 | (com.google.protobuf.ByteString) ref;
906 | java.lang.String s = bs.toStringUtf8();
907 | upstreamAuth_ = s;
908 | return s;
909 | } else {
910 | return (java.lang.String) ref;
911 | }
912 | }
913 | /**
914 | * string upstreamAuth = 6;
915 | */
916 | public com.google.protobuf.ByteString
917 | getUpstreamAuthBytes() {
918 | java.lang.Object ref = upstreamAuth_;
919 | if (ref instanceof String) {
920 | com.google.protobuf.ByteString b =
921 | com.google.protobuf.ByteString.copyFromUtf8(
922 | (java.lang.String) ref);
923 | upstreamAuth_ = b;
924 | return b;
925 | } else {
926 | return (com.google.protobuf.ByteString) ref;
927 | }
928 | }
929 | /**
930 | * string upstreamAuth = 6;
931 | */
932 | public Builder setUpstreamAuth(
933 | java.lang.String value) {
934 | if (value == null) {
935 | throw new NullPointerException();
936 | }
937 |
938 | upstreamAuth_ = value;
939 | onChanged();
940 | return this;
941 | }
942 | /**
943 | * string upstreamAuth = 6;
944 | */
945 | public Builder clearUpstreamAuth() {
946 |
947 | upstreamAuth_ = getDefaultInstance().getUpstreamAuth();
948 | onChanged();
949 | return this;
950 | }
951 | /**
952 | * string upstreamAuth = 6;
953 | */
954 | public Builder setUpstreamAuthBytes(
955 | com.google.protobuf.ByteString value) {
956 | if (value == null) {
957 | throw new NullPointerException();
958 | }
959 | checkByteStringIsUtf8(value);
960 |
961 | upstreamAuth_ = value;
962 | onChanged();
963 | return this;
964 | }
965 | public final Builder setUnknownFields(
966 | final com.google.protobuf.UnknownFieldSet unknownFields) {
967 | return super.setUnknownFieldsProto3(unknownFields);
968 | }
969 |
970 | public final Builder mergeUnknownFields(
971 | final com.google.protobuf.UnknownFieldSet unknownFields) {
972 | return super.mergeUnknownFields(unknownFields);
973 | }
974 |
975 |
976 | // @@protoc_insertion_point(builder_scope:mitm.MitmproxyStartRequest)
977 | }
978 |
979 | // @@protoc_insertion_point(class_scope:mitm.MitmproxyStartRequest)
980 | private static final com.deep007.mitmproxyjava.MitmproxyStartRequest DEFAULT_INSTANCE;
981 | static {
982 | DEFAULT_INSTANCE = new com.deep007.mitmproxyjava.MitmproxyStartRequest();
983 | }
984 |
985 | public static com.deep007.mitmproxyjava.MitmproxyStartRequest getDefaultInstance() {
986 | return DEFAULT_INSTANCE;
987 | }
988 |
989 | private static final com.google.protobuf.Parserstring bind = 1;
12 | */
13 | java.lang.String getBind();
14 | /**
15 | * string bind = 1;
16 | */
17 | com.google.protobuf.ByteString
18 | getBindBytes();
19 |
20 | /**
21 | * int32 port = 2;
22 | */
23 | int getPort();
24 |
25 | /**
26 | * string callbackServerAddr = 3;
27 | */
28 | java.lang.String getCallbackServerAddr();
29 | /**
30 | * string callbackServerAddr = 3;
31 | */
32 | com.google.protobuf.ByteString
33 | getCallbackServerAddrBytes();
34 |
35 | /**
36 | * int32 callbackServerPort = 4;
37 | */
38 | int getCallbackServerPort();
39 |
40 | /**
41 | * string upstream = 5;
42 | */
43 | java.lang.String getUpstream();
44 | /**
45 | * string upstream = 5;
46 | */
47 | com.google.protobuf.ByteString
48 | getUpstreamBytes();
49 |
50 | /**
51 | * string upstreamAuth = 6;
52 | */
53 | java.lang.String getUpstreamAuth();
54 | /**
55 | * string upstreamAuth = 6;
56 | */
57 | com.google.protobuf.ByteString
58 | getUpstreamAuthBytes();
59 | }
60 |
--------------------------------------------------------------------------------
/src/main/java/com/deep007/mitmproxyjava/MitmproxyStartResponse.java:
--------------------------------------------------------------------------------
1 | // Generated by the protocol buffer compiler. DO NOT EDIT!
2 | // source: mitm_hub_client.proto
3 |
4 | package com.deep007.mitmproxyjava;
5 |
6 | /**
7 | * Protobuf type {@code mitm.MitmproxyStartResponse}
8 | */
9 | public final class MitmproxyStartResponse extends
10 | com.google.protobuf.GeneratedMessageV3 implements
11 | // @@protoc_insertion_point(message_implements:mitm.MitmproxyStartResponse)
12 | MitmproxyStartResponseOrBuilder {
13 | private static final long serialVersionUID = 0L;
14 | // Use MitmproxyStartResponse.newBuilder() to construct.
15 | private MitmproxyStartResponse(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
16 | super(builder);
17 | }
18 | private MitmproxyStartResponse() {
19 | mitmproxyId_ = "";
20 | }
21 |
22 | @java.lang.Override
23 | public final com.google.protobuf.UnknownFieldSet
24 | getUnknownFields() {
25 | return this.unknownFields;
26 | }
27 | private MitmproxyStartResponse(
28 | com.google.protobuf.CodedInputStream input,
29 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
30 | throws com.google.protobuf.InvalidProtocolBufferException {
31 | this();
32 | if (extensionRegistry == null) {
33 | throw new java.lang.NullPointerException();
34 | }
35 | int mutable_bitField0_ = 0;
36 | com.google.protobuf.UnknownFieldSet.Builder unknownFields =
37 | com.google.protobuf.UnknownFieldSet.newBuilder();
38 | try {
39 | boolean done = false;
40 | while (!done) {
41 | int tag = input.readTag();
42 | switch (tag) {
43 | case 0:
44 | done = true;
45 | break;
46 | default: {
47 | if (!parseUnknownFieldProto3(
48 | input, unknownFields, extensionRegistry, tag)) {
49 | done = true;
50 | }
51 | break;
52 | }
53 | case 10: {
54 | java.lang.String s = input.readStringRequireUtf8();
55 |
56 | mitmproxyId_ = s;
57 | break;
58 | }
59 | }
60 | }
61 | } catch (com.google.protobuf.InvalidProtocolBufferException e) {
62 | throw e.setUnfinishedMessage(this);
63 | } catch (java.io.IOException e) {
64 | throw new com.google.protobuf.InvalidProtocolBufferException(
65 | e).setUnfinishedMessage(this);
66 | } finally {
67 | this.unknownFields = unknownFields.build();
68 | makeExtensionsImmutable();
69 | }
70 | }
71 | public static final com.google.protobuf.Descriptors.Descriptor
72 | getDescriptor() {
73 | return com.deep007.mitmproxyjava.MitmProxyHubClientServerProto.internal_static_mitm_MitmproxyStartResponse_descriptor;
74 | }
75 |
76 | protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
77 | internalGetFieldAccessorTable() {
78 | return com.deep007.mitmproxyjava.MitmProxyHubClientServerProto.internal_static_mitm_MitmproxyStartResponse_fieldAccessorTable
79 | .ensureFieldAccessorsInitialized(
80 | com.deep007.mitmproxyjava.MitmproxyStartResponse.class, com.deep007.mitmproxyjava.MitmproxyStartResponse.Builder.class);
81 | }
82 |
83 | public static final int MITMPROXYID_FIELD_NUMBER = 1;
84 | private volatile java.lang.Object mitmproxyId_;
85 | /**
86 | * string mitmproxyId = 1;
87 | */
88 | public java.lang.String getMitmproxyId() {
89 | java.lang.Object ref = mitmproxyId_;
90 | if (ref instanceof java.lang.String) {
91 | return (java.lang.String) ref;
92 | } else {
93 | com.google.protobuf.ByteString bs =
94 | (com.google.protobuf.ByteString) ref;
95 | java.lang.String s = bs.toStringUtf8();
96 | mitmproxyId_ = s;
97 | return s;
98 | }
99 | }
100 | /**
101 | * string mitmproxyId = 1;
102 | */
103 | public com.google.protobuf.ByteString
104 | getMitmproxyIdBytes() {
105 | java.lang.Object ref = mitmproxyId_;
106 | if (ref instanceof java.lang.String) {
107 | com.google.protobuf.ByteString b =
108 | com.google.protobuf.ByteString.copyFromUtf8(
109 | (java.lang.String) ref);
110 | mitmproxyId_ = b;
111 | return b;
112 | } else {
113 | return (com.google.protobuf.ByteString) ref;
114 | }
115 | }
116 |
117 | private byte memoizedIsInitialized = -1;
118 | public final boolean isInitialized() {
119 | byte isInitialized = memoizedIsInitialized;
120 | if (isInitialized == 1) return true;
121 | if (isInitialized == 0) return false;
122 |
123 | memoizedIsInitialized = 1;
124 | return true;
125 | }
126 |
127 | public void writeTo(com.google.protobuf.CodedOutputStream output)
128 | throws java.io.IOException {
129 | if (!getMitmproxyIdBytes().isEmpty()) {
130 | com.google.protobuf.GeneratedMessageV3.writeString(output, 1, mitmproxyId_);
131 | }
132 | unknownFields.writeTo(output);
133 | }
134 |
135 | public int getSerializedSize() {
136 | int size = memoizedSize;
137 | if (size != -1) return size;
138 |
139 | size = 0;
140 | if (!getMitmproxyIdBytes().isEmpty()) {
141 | size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, mitmproxyId_);
142 | }
143 | size += unknownFields.getSerializedSize();
144 | memoizedSize = size;
145 | return size;
146 | }
147 |
148 | @java.lang.Override
149 | public boolean equals(final java.lang.Object obj) {
150 | if (obj == this) {
151 | return true;
152 | }
153 | if (!(obj instanceof com.deep007.mitmproxyjava.MitmproxyStartResponse)) {
154 | return super.equals(obj);
155 | }
156 | com.deep007.mitmproxyjava.MitmproxyStartResponse other = (com.deep007.mitmproxyjava.MitmproxyStartResponse) obj;
157 |
158 | boolean result = true;
159 | result = result && getMitmproxyId()
160 | .equals(other.getMitmproxyId());
161 | result = result && unknownFields.equals(other.unknownFields);
162 | return result;
163 | }
164 |
165 | @java.lang.Override
166 | public int hashCode() {
167 | if (memoizedHashCode != 0) {
168 | return memoizedHashCode;
169 | }
170 | int hash = 41;
171 | hash = (19 * hash) + getDescriptor().hashCode();
172 | hash = (37 * hash) + MITMPROXYID_FIELD_NUMBER;
173 | hash = (53 * hash) + getMitmproxyId().hashCode();
174 | hash = (29 * hash) + unknownFields.hashCode();
175 | memoizedHashCode = hash;
176 | return hash;
177 | }
178 |
179 | public static com.deep007.mitmproxyjava.MitmproxyStartResponse parseFrom(
180 | java.nio.ByteBuffer data)
181 | throws com.google.protobuf.InvalidProtocolBufferException {
182 | return PARSER.parseFrom(data);
183 | }
184 | public static com.deep007.mitmproxyjava.MitmproxyStartResponse parseFrom(
185 | java.nio.ByteBuffer data,
186 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
187 | throws com.google.protobuf.InvalidProtocolBufferException {
188 | return PARSER.parseFrom(data, extensionRegistry);
189 | }
190 | public static com.deep007.mitmproxyjava.MitmproxyStartResponse parseFrom(
191 | com.google.protobuf.ByteString data)
192 | throws com.google.protobuf.InvalidProtocolBufferException {
193 | return PARSER.parseFrom(data);
194 | }
195 | public static com.deep007.mitmproxyjava.MitmproxyStartResponse parseFrom(
196 | com.google.protobuf.ByteString data,
197 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
198 | throws com.google.protobuf.InvalidProtocolBufferException {
199 | return PARSER.parseFrom(data, extensionRegistry);
200 | }
201 | public static com.deep007.mitmproxyjava.MitmproxyStartResponse parseFrom(byte[] data)
202 | throws com.google.protobuf.InvalidProtocolBufferException {
203 | return PARSER.parseFrom(data);
204 | }
205 | public static com.deep007.mitmproxyjava.MitmproxyStartResponse parseFrom(
206 | byte[] data,
207 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
208 | throws com.google.protobuf.InvalidProtocolBufferException {
209 | return PARSER.parseFrom(data, extensionRegistry);
210 | }
211 | public static com.deep007.mitmproxyjava.MitmproxyStartResponse parseFrom(java.io.InputStream input)
212 | throws java.io.IOException {
213 | return com.google.protobuf.GeneratedMessageV3
214 | .parseWithIOException(PARSER, input);
215 | }
216 | public static com.deep007.mitmproxyjava.MitmproxyStartResponse parseFrom(
217 | java.io.InputStream input,
218 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
219 | throws java.io.IOException {
220 | return com.google.protobuf.GeneratedMessageV3
221 | .parseWithIOException(PARSER, input, extensionRegistry);
222 | }
223 | public static com.deep007.mitmproxyjava.MitmproxyStartResponse parseDelimitedFrom(java.io.InputStream input)
224 | throws java.io.IOException {
225 | return com.google.protobuf.GeneratedMessageV3
226 | .parseDelimitedWithIOException(PARSER, input);
227 | }
228 | public static com.deep007.mitmproxyjava.MitmproxyStartResponse parseDelimitedFrom(
229 | java.io.InputStream input,
230 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
231 | throws java.io.IOException {
232 | return com.google.protobuf.GeneratedMessageV3
233 | .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
234 | }
235 | public static com.deep007.mitmproxyjava.MitmproxyStartResponse parseFrom(
236 | com.google.protobuf.CodedInputStream input)
237 | throws java.io.IOException {
238 | return com.google.protobuf.GeneratedMessageV3
239 | .parseWithIOException(PARSER, input);
240 | }
241 | public static com.deep007.mitmproxyjava.MitmproxyStartResponse parseFrom(
242 | com.google.protobuf.CodedInputStream input,
243 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
244 | throws java.io.IOException {
245 | return com.google.protobuf.GeneratedMessageV3
246 | .parseWithIOException(PARSER, input, extensionRegistry);
247 | }
248 |
249 | public Builder newBuilderForType() { return newBuilder(); }
250 | public static Builder newBuilder() {
251 | return DEFAULT_INSTANCE.toBuilder();
252 | }
253 | public static Builder newBuilder(com.deep007.mitmproxyjava.MitmproxyStartResponse prototype) {
254 | return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
255 | }
256 | public Builder toBuilder() {
257 | return this == DEFAULT_INSTANCE
258 | ? new Builder() : new Builder().mergeFrom(this);
259 | }
260 |
261 | @java.lang.Override
262 | protected Builder newBuilderForType(
263 | com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
264 | Builder builder = new Builder(parent);
265 | return builder;
266 | }
267 | /**
268 | * Protobuf type {@code mitm.MitmproxyStartResponse}
269 | */
270 | public static final class Builder extends
271 | com.google.protobuf.GeneratedMessageV3.Builderstring mitmproxyId = 1;
403 | */
404 | public java.lang.String getMitmproxyId() {
405 | java.lang.Object ref = mitmproxyId_;
406 | if (!(ref instanceof java.lang.String)) {
407 | com.google.protobuf.ByteString bs =
408 | (com.google.protobuf.ByteString) ref;
409 | java.lang.String s = bs.toStringUtf8();
410 | mitmproxyId_ = s;
411 | return s;
412 | } else {
413 | return (java.lang.String) ref;
414 | }
415 | }
416 | /**
417 | * string mitmproxyId = 1;
418 | */
419 | public com.google.protobuf.ByteString
420 | getMitmproxyIdBytes() {
421 | java.lang.Object ref = mitmproxyId_;
422 | if (ref instanceof String) {
423 | com.google.protobuf.ByteString b =
424 | com.google.protobuf.ByteString.copyFromUtf8(
425 | (java.lang.String) ref);
426 | mitmproxyId_ = b;
427 | return b;
428 | } else {
429 | return (com.google.protobuf.ByteString) ref;
430 | }
431 | }
432 | /**
433 | * string mitmproxyId = 1;
434 | */
435 | public Builder setMitmproxyId(
436 | java.lang.String value) {
437 | if (value == null) {
438 | throw new NullPointerException();
439 | }
440 |
441 | mitmproxyId_ = value;
442 | onChanged();
443 | return this;
444 | }
445 | /**
446 | * string mitmproxyId = 1;
447 | */
448 | public Builder clearMitmproxyId() {
449 |
450 | mitmproxyId_ = getDefaultInstance().getMitmproxyId();
451 | onChanged();
452 | return this;
453 | }
454 | /**
455 | * string mitmproxyId = 1;
456 | */
457 | public Builder setMitmproxyIdBytes(
458 | com.google.protobuf.ByteString value) {
459 | if (value == null) {
460 | throw new NullPointerException();
461 | }
462 | checkByteStringIsUtf8(value);
463 |
464 | mitmproxyId_ = value;
465 | onChanged();
466 | return this;
467 | }
468 | public final Builder setUnknownFields(
469 | final com.google.protobuf.UnknownFieldSet unknownFields) {
470 | return super.setUnknownFieldsProto3(unknownFields);
471 | }
472 |
473 | public final Builder mergeUnknownFields(
474 | final com.google.protobuf.UnknownFieldSet unknownFields) {
475 | return super.mergeUnknownFields(unknownFields);
476 | }
477 |
478 |
479 | // @@protoc_insertion_point(builder_scope:mitm.MitmproxyStartResponse)
480 | }
481 |
482 | // @@protoc_insertion_point(class_scope:mitm.MitmproxyStartResponse)
483 | private static final com.deep007.mitmproxyjava.MitmproxyStartResponse DEFAULT_INSTANCE;
484 | static {
485 | DEFAULT_INSTANCE = new com.deep007.mitmproxyjava.MitmproxyStartResponse();
486 | }
487 |
488 | public static com.deep007.mitmproxyjava.MitmproxyStartResponse getDefaultInstance() {
489 | return DEFAULT_INSTANCE;
490 | }
491 |
492 | private static final com.google.protobuf.Parserstring mitmproxyId = 1;
12 | */
13 | java.lang.String getMitmproxyId();
14 | /**
15 | * string mitmproxyId = 1;
16 | */
17 | com.google.protobuf.ByteString
18 | getMitmproxyIdBytes();
19 | }
20 |
--------------------------------------------------------------------------------
/src/main/java/com/deep007/mitmproxyjava/MitmproxyStopRequest.java:
--------------------------------------------------------------------------------
1 | // Generated by the protocol buffer compiler. DO NOT EDIT!
2 | // source: mitm_hub_client.proto
3 |
4 | package com.deep007.mitmproxyjava;
5 |
6 | /**
7 | * Protobuf type {@code mitm.MitmproxyStopRequest}
8 | */
9 | public final class MitmproxyStopRequest extends
10 | com.google.protobuf.GeneratedMessageV3 implements
11 | // @@protoc_insertion_point(message_implements:mitm.MitmproxyStopRequest)
12 | MitmproxyStopRequestOrBuilder {
13 | private static final long serialVersionUID = 0L;
14 | // Use MitmproxyStopRequest.newBuilder() to construct.
15 | private MitmproxyStopRequest(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
16 | super(builder);
17 | }
18 | private MitmproxyStopRequest() {
19 | mitmproxyId_ = "";
20 | }
21 |
22 | @java.lang.Override
23 | public final com.google.protobuf.UnknownFieldSet
24 | getUnknownFields() {
25 | return this.unknownFields;
26 | }
27 | private MitmproxyStopRequest(
28 | com.google.protobuf.CodedInputStream input,
29 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
30 | throws com.google.protobuf.InvalidProtocolBufferException {
31 | this();
32 | if (extensionRegistry == null) {
33 | throw new java.lang.NullPointerException();
34 | }
35 | int mutable_bitField0_ = 0;
36 | com.google.protobuf.UnknownFieldSet.Builder unknownFields =
37 | com.google.protobuf.UnknownFieldSet.newBuilder();
38 | try {
39 | boolean done = false;
40 | while (!done) {
41 | int tag = input.readTag();
42 | switch (tag) {
43 | case 0:
44 | done = true;
45 | break;
46 | default: {
47 | if (!parseUnknownFieldProto3(
48 | input, unknownFields, extensionRegistry, tag)) {
49 | done = true;
50 | }
51 | break;
52 | }
53 | case 10: {
54 | java.lang.String s = input.readStringRequireUtf8();
55 |
56 | mitmproxyId_ = s;
57 | break;
58 | }
59 | }
60 | }
61 | } catch (com.google.protobuf.InvalidProtocolBufferException e) {
62 | throw e.setUnfinishedMessage(this);
63 | } catch (java.io.IOException e) {
64 | throw new com.google.protobuf.InvalidProtocolBufferException(
65 | e).setUnfinishedMessage(this);
66 | } finally {
67 | this.unknownFields = unknownFields.build();
68 | makeExtensionsImmutable();
69 | }
70 | }
71 | public static final com.google.protobuf.Descriptors.Descriptor
72 | getDescriptor() {
73 | return com.deep007.mitmproxyjava.MitmProxyHubClientServerProto.internal_static_mitm_MitmproxyStopRequest_descriptor;
74 | }
75 |
76 | protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
77 | internalGetFieldAccessorTable() {
78 | return com.deep007.mitmproxyjava.MitmProxyHubClientServerProto.internal_static_mitm_MitmproxyStopRequest_fieldAccessorTable
79 | .ensureFieldAccessorsInitialized(
80 | com.deep007.mitmproxyjava.MitmproxyStopRequest.class, com.deep007.mitmproxyjava.MitmproxyStopRequest.Builder.class);
81 | }
82 |
83 | public static final int MITMPROXYID_FIELD_NUMBER = 1;
84 | private volatile java.lang.Object mitmproxyId_;
85 | /**
86 | * string mitmproxyId = 1;
87 | */
88 | public java.lang.String getMitmproxyId() {
89 | java.lang.Object ref = mitmproxyId_;
90 | if (ref instanceof java.lang.String) {
91 | return (java.lang.String) ref;
92 | } else {
93 | com.google.protobuf.ByteString bs =
94 | (com.google.protobuf.ByteString) ref;
95 | java.lang.String s = bs.toStringUtf8();
96 | mitmproxyId_ = s;
97 | return s;
98 | }
99 | }
100 | /**
101 | * string mitmproxyId = 1;
102 | */
103 | public com.google.protobuf.ByteString
104 | getMitmproxyIdBytes() {
105 | java.lang.Object ref = mitmproxyId_;
106 | if (ref instanceof java.lang.String) {
107 | com.google.protobuf.ByteString b =
108 | com.google.protobuf.ByteString.copyFromUtf8(
109 | (java.lang.String) ref);
110 | mitmproxyId_ = b;
111 | return b;
112 | } else {
113 | return (com.google.protobuf.ByteString) ref;
114 | }
115 | }
116 |
117 | private byte memoizedIsInitialized = -1;
118 | public final boolean isInitialized() {
119 | byte isInitialized = memoizedIsInitialized;
120 | if (isInitialized == 1) return true;
121 | if (isInitialized == 0) return false;
122 |
123 | memoizedIsInitialized = 1;
124 | return true;
125 | }
126 |
127 | public void writeTo(com.google.protobuf.CodedOutputStream output)
128 | throws java.io.IOException {
129 | if (!getMitmproxyIdBytes().isEmpty()) {
130 | com.google.protobuf.GeneratedMessageV3.writeString(output, 1, mitmproxyId_);
131 | }
132 | unknownFields.writeTo(output);
133 | }
134 |
135 | public int getSerializedSize() {
136 | int size = memoizedSize;
137 | if (size != -1) return size;
138 |
139 | size = 0;
140 | if (!getMitmproxyIdBytes().isEmpty()) {
141 | size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, mitmproxyId_);
142 | }
143 | size += unknownFields.getSerializedSize();
144 | memoizedSize = size;
145 | return size;
146 | }
147 |
148 | @java.lang.Override
149 | public boolean equals(final java.lang.Object obj) {
150 | if (obj == this) {
151 | return true;
152 | }
153 | if (!(obj instanceof com.deep007.mitmproxyjava.MitmproxyStopRequest)) {
154 | return super.equals(obj);
155 | }
156 | com.deep007.mitmproxyjava.MitmproxyStopRequest other = (com.deep007.mitmproxyjava.MitmproxyStopRequest) obj;
157 |
158 | boolean result = true;
159 | result = result && getMitmproxyId()
160 | .equals(other.getMitmproxyId());
161 | result = result && unknownFields.equals(other.unknownFields);
162 | return result;
163 | }
164 |
165 | @java.lang.Override
166 | public int hashCode() {
167 | if (memoizedHashCode != 0) {
168 | return memoizedHashCode;
169 | }
170 | int hash = 41;
171 | hash = (19 * hash) + getDescriptor().hashCode();
172 | hash = (37 * hash) + MITMPROXYID_FIELD_NUMBER;
173 | hash = (53 * hash) + getMitmproxyId().hashCode();
174 | hash = (29 * hash) + unknownFields.hashCode();
175 | memoizedHashCode = hash;
176 | return hash;
177 | }
178 |
179 | public static com.deep007.mitmproxyjava.MitmproxyStopRequest parseFrom(
180 | java.nio.ByteBuffer data)
181 | throws com.google.protobuf.InvalidProtocolBufferException {
182 | return PARSER.parseFrom(data);
183 | }
184 | public static com.deep007.mitmproxyjava.MitmproxyStopRequest parseFrom(
185 | java.nio.ByteBuffer data,
186 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
187 | throws com.google.protobuf.InvalidProtocolBufferException {
188 | return PARSER.parseFrom(data, extensionRegistry);
189 | }
190 | public static com.deep007.mitmproxyjava.MitmproxyStopRequest parseFrom(
191 | com.google.protobuf.ByteString data)
192 | throws com.google.protobuf.InvalidProtocolBufferException {
193 | return PARSER.parseFrom(data);
194 | }
195 | public static com.deep007.mitmproxyjava.MitmproxyStopRequest parseFrom(
196 | com.google.protobuf.ByteString data,
197 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
198 | throws com.google.protobuf.InvalidProtocolBufferException {
199 | return PARSER.parseFrom(data, extensionRegistry);
200 | }
201 | public static com.deep007.mitmproxyjava.MitmproxyStopRequest parseFrom(byte[] data)
202 | throws com.google.protobuf.InvalidProtocolBufferException {
203 | return PARSER.parseFrom(data);
204 | }
205 | public static com.deep007.mitmproxyjava.MitmproxyStopRequest parseFrom(
206 | byte[] data,
207 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
208 | throws com.google.protobuf.InvalidProtocolBufferException {
209 | return PARSER.parseFrom(data, extensionRegistry);
210 | }
211 | public static com.deep007.mitmproxyjava.MitmproxyStopRequest parseFrom(java.io.InputStream input)
212 | throws java.io.IOException {
213 | return com.google.protobuf.GeneratedMessageV3
214 | .parseWithIOException(PARSER, input);
215 | }
216 | public static com.deep007.mitmproxyjava.MitmproxyStopRequest parseFrom(
217 | java.io.InputStream input,
218 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
219 | throws java.io.IOException {
220 | return com.google.protobuf.GeneratedMessageV3
221 | .parseWithIOException(PARSER, input, extensionRegistry);
222 | }
223 | public static com.deep007.mitmproxyjava.MitmproxyStopRequest parseDelimitedFrom(java.io.InputStream input)
224 | throws java.io.IOException {
225 | return com.google.protobuf.GeneratedMessageV3
226 | .parseDelimitedWithIOException(PARSER, input);
227 | }
228 | public static com.deep007.mitmproxyjava.MitmproxyStopRequest parseDelimitedFrom(
229 | java.io.InputStream input,
230 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
231 | throws java.io.IOException {
232 | return com.google.protobuf.GeneratedMessageV3
233 | .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
234 | }
235 | public static com.deep007.mitmproxyjava.MitmproxyStopRequest parseFrom(
236 | com.google.protobuf.CodedInputStream input)
237 | throws java.io.IOException {
238 | return com.google.protobuf.GeneratedMessageV3
239 | .parseWithIOException(PARSER, input);
240 | }
241 | public static com.deep007.mitmproxyjava.MitmproxyStopRequest parseFrom(
242 | com.google.protobuf.CodedInputStream input,
243 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
244 | throws java.io.IOException {
245 | return com.google.protobuf.GeneratedMessageV3
246 | .parseWithIOException(PARSER, input, extensionRegistry);
247 | }
248 |
249 | public Builder newBuilderForType() { return newBuilder(); }
250 | public static Builder newBuilder() {
251 | return DEFAULT_INSTANCE.toBuilder();
252 | }
253 | public static Builder newBuilder(com.deep007.mitmproxyjava.MitmproxyStopRequest prototype) {
254 | return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
255 | }
256 | public Builder toBuilder() {
257 | return this == DEFAULT_INSTANCE
258 | ? new Builder() : new Builder().mergeFrom(this);
259 | }
260 |
261 | @java.lang.Override
262 | protected Builder newBuilderForType(
263 | com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
264 | Builder builder = new Builder(parent);
265 | return builder;
266 | }
267 | /**
268 | * Protobuf type {@code mitm.MitmproxyStopRequest}
269 | */
270 | public static final class Builder extends
271 | com.google.protobuf.GeneratedMessageV3.Builderstring mitmproxyId = 1;
403 | */
404 | public java.lang.String getMitmproxyId() {
405 | java.lang.Object ref = mitmproxyId_;
406 | if (!(ref instanceof java.lang.String)) {
407 | com.google.protobuf.ByteString bs =
408 | (com.google.protobuf.ByteString) ref;
409 | java.lang.String s = bs.toStringUtf8();
410 | mitmproxyId_ = s;
411 | return s;
412 | } else {
413 | return (java.lang.String) ref;
414 | }
415 | }
416 | /**
417 | * string mitmproxyId = 1;
418 | */
419 | public com.google.protobuf.ByteString
420 | getMitmproxyIdBytes() {
421 | java.lang.Object ref = mitmproxyId_;
422 | if (ref instanceof String) {
423 | com.google.protobuf.ByteString b =
424 | com.google.protobuf.ByteString.copyFromUtf8(
425 | (java.lang.String) ref);
426 | mitmproxyId_ = b;
427 | return b;
428 | } else {
429 | return (com.google.protobuf.ByteString) ref;
430 | }
431 | }
432 | /**
433 | * string mitmproxyId = 1;
434 | */
435 | public Builder setMitmproxyId(
436 | java.lang.String value) {
437 | if (value == null) {
438 | throw new NullPointerException();
439 | }
440 |
441 | mitmproxyId_ = value;
442 | onChanged();
443 | return this;
444 | }
445 | /**
446 | * string mitmproxyId = 1;
447 | */
448 | public Builder clearMitmproxyId() {
449 |
450 | mitmproxyId_ = getDefaultInstance().getMitmproxyId();
451 | onChanged();
452 | return this;
453 | }
454 | /**
455 | * string mitmproxyId = 1;
456 | */
457 | public Builder setMitmproxyIdBytes(
458 | com.google.protobuf.ByteString value) {
459 | if (value == null) {
460 | throw new NullPointerException();
461 | }
462 | checkByteStringIsUtf8(value);
463 |
464 | mitmproxyId_ = value;
465 | onChanged();
466 | return this;
467 | }
468 | public final Builder setUnknownFields(
469 | final com.google.protobuf.UnknownFieldSet unknownFields) {
470 | return super.setUnknownFieldsProto3(unknownFields);
471 | }
472 |
473 | public final Builder mergeUnknownFields(
474 | final com.google.protobuf.UnknownFieldSet unknownFields) {
475 | return super.mergeUnknownFields(unknownFields);
476 | }
477 |
478 |
479 | // @@protoc_insertion_point(builder_scope:mitm.MitmproxyStopRequest)
480 | }
481 |
482 | // @@protoc_insertion_point(class_scope:mitm.MitmproxyStopRequest)
483 | private static final com.deep007.mitmproxyjava.MitmproxyStopRequest DEFAULT_INSTANCE;
484 | static {
485 | DEFAULT_INSTANCE = new com.deep007.mitmproxyjava.MitmproxyStopRequest();
486 | }
487 |
488 | public static com.deep007.mitmproxyjava.MitmproxyStopRequest getDefaultInstance() {
489 | return DEFAULT_INSTANCE;
490 | }
491 |
492 | private static final com.google.protobuf.Parserstring mitmproxyId = 1;
12 | */
13 | java.lang.String getMitmproxyId();
14 | /**
15 | * string mitmproxyId = 1;
16 | */
17 | com.google.protobuf.ByteString
18 | getMitmproxyIdBytes();
19 | }
20 |
--------------------------------------------------------------------------------
/src/main/java/com/deep007/mitmproxyjava/VoidResponse.java:
--------------------------------------------------------------------------------
1 | // Generated by the protocol buffer compiler. DO NOT EDIT!
2 | // source: mitm_hub_client.proto
3 |
4 | package com.deep007.mitmproxyjava;
5 |
6 | /**
7 | * Protobuf type {@code mitm.VoidResponse}
8 | */
9 | public final class VoidResponse extends
10 | com.google.protobuf.GeneratedMessageV3 implements
11 | // @@protoc_insertion_point(message_implements:mitm.VoidResponse)
12 | VoidResponseOrBuilder {
13 | private static final long serialVersionUID = 0L;
14 | // Use VoidResponse.newBuilder() to construct.
15 | private VoidResponse(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
16 | super(builder);
17 | }
18 | private VoidResponse() {
19 | }
20 |
21 | @java.lang.Override
22 | public final com.google.protobuf.UnknownFieldSet
23 | getUnknownFields() {
24 | return this.unknownFields;
25 | }
26 | private VoidResponse(
27 | com.google.protobuf.CodedInputStream input,
28 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
29 | throws com.google.protobuf.InvalidProtocolBufferException {
30 | this();
31 | if (extensionRegistry == null) {
32 | throw new java.lang.NullPointerException();
33 | }
34 | com.google.protobuf.UnknownFieldSet.Builder unknownFields =
35 | com.google.protobuf.UnknownFieldSet.newBuilder();
36 | try {
37 | boolean done = false;
38 | while (!done) {
39 | int tag = input.readTag();
40 | switch (tag) {
41 | case 0:
42 | done = true;
43 | break;
44 | default: {
45 | if (!parseUnknownFieldProto3(
46 | input, unknownFields, extensionRegistry, tag)) {
47 | done = true;
48 | }
49 | break;
50 | }
51 | }
52 | }
53 | } catch (com.google.protobuf.InvalidProtocolBufferException e) {
54 | throw e.setUnfinishedMessage(this);
55 | } catch (java.io.IOException e) {
56 | throw new com.google.protobuf.InvalidProtocolBufferException(
57 | e).setUnfinishedMessage(this);
58 | } finally {
59 | this.unknownFields = unknownFields.build();
60 | makeExtensionsImmutable();
61 | }
62 | }
63 | public static final com.google.protobuf.Descriptors.Descriptor
64 | getDescriptor() {
65 | return com.deep007.mitmproxyjava.MitmProxyHubClientServerProto.internal_static_mitm_VoidResponse_descriptor;
66 | }
67 |
68 | protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
69 | internalGetFieldAccessorTable() {
70 | return com.deep007.mitmproxyjava.MitmProxyHubClientServerProto.internal_static_mitm_VoidResponse_fieldAccessorTable
71 | .ensureFieldAccessorsInitialized(
72 | com.deep007.mitmproxyjava.VoidResponse.class, com.deep007.mitmproxyjava.VoidResponse.Builder.class);
73 | }
74 |
75 | private byte memoizedIsInitialized = -1;
76 | public final boolean isInitialized() {
77 | byte isInitialized = memoizedIsInitialized;
78 | if (isInitialized == 1) return true;
79 | if (isInitialized == 0) return false;
80 |
81 | memoizedIsInitialized = 1;
82 | return true;
83 | }
84 |
85 | public void writeTo(com.google.protobuf.CodedOutputStream output)
86 | throws java.io.IOException {
87 | unknownFields.writeTo(output);
88 | }
89 |
90 | public int getSerializedSize() {
91 | int size = memoizedSize;
92 | if (size != -1) return size;
93 |
94 | size = 0;
95 | size += unknownFields.getSerializedSize();
96 | memoizedSize = size;
97 | return size;
98 | }
99 |
100 | @java.lang.Override
101 | public boolean equals(final java.lang.Object obj) {
102 | if (obj == this) {
103 | return true;
104 | }
105 | if (!(obj instanceof com.deep007.mitmproxyjava.VoidResponse)) {
106 | return super.equals(obj);
107 | }
108 | com.deep007.mitmproxyjava.VoidResponse other = (com.deep007.mitmproxyjava.VoidResponse) obj;
109 |
110 | boolean result = true;
111 | result = result && unknownFields.equals(other.unknownFields);
112 | return result;
113 | }
114 |
115 | @java.lang.Override
116 | public int hashCode() {
117 | if (memoizedHashCode != 0) {
118 | return memoizedHashCode;
119 | }
120 | int hash = 41;
121 | hash = (19 * hash) + getDescriptor().hashCode();
122 | hash = (29 * hash) + unknownFields.hashCode();
123 | memoizedHashCode = hash;
124 | return hash;
125 | }
126 |
127 | public static com.deep007.mitmproxyjava.VoidResponse parseFrom(
128 | java.nio.ByteBuffer data)
129 | throws com.google.protobuf.InvalidProtocolBufferException {
130 | return PARSER.parseFrom(data);
131 | }
132 | public static com.deep007.mitmproxyjava.VoidResponse parseFrom(
133 | java.nio.ByteBuffer data,
134 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
135 | throws com.google.protobuf.InvalidProtocolBufferException {
136 | return PARSER.parseFrom(data, extensionRegistry);
137 | }
138 | public static com.deep007.mitmproxyjava.VoidResponse parseFrom(
139 | com.google.protobuf.ByteString data)
140 | throws com.google.protobuf.InvalidProtocolBufferException {
141 | return PARSER.parseFrom(data);
142 | }
143 | public static com.deep007.mitmproxyjava.VoidResponse parseFrom(
144 | com.google.protobuf.ByteString data,
145 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
146 | throws com.google.protobuf.InvalidProtocolBufferException {
147 | return PARSER.parseFrom(data, extensionRegistry);
148 | }
149 | public static com.deep007.mitmproxyjava.VoidResponse parseFrom(byte[] data)
150 | throws com.google.protobuf.InvalidProtocolBufferException {
151 | return PARSER.parseFrom(data);
152 | }
153 | public static com.deep007.mitmproxyjava.VoidResponse parseFrom(
154 | byte[] data,
155 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
156 | throws com.google.protobuf.InvalidProtocolBufferException {
157 | return PARSER.parseFrom(data, extensionRegistry);
158 | }
159 | public static com.deep007.mitmproxyjava.VoidResponse parseFrom(java.io.InputStream input)
160 | throws java.io.IOException {
161 | return com.google.protobuf.GeneratedMessageV3
162 | .parseWithIOException(PARSER, input);
163 | }
164 | public static com.deep007.mitmproxyjava.VoidResponse parseFrom(
165 | java.io.InputStream input,
166 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
167 | throws java.io.IOException {
168 | return com.google.protobuf.GeneratedMessageV3
169 | .parseWithIOException(PARSER, input, extensionRegistry);
170 | }
171 | public static com.deep007.mitmproxyjava.VoidResponse parseDelimitedFrom(java.io.InputStream input)
172 | throws java.io.IOException {
173 | return com.google.protobuf.GeneratedMessageV3
174 | .parseDelimitedWithIOException(PARSER, input);
175 | }
176 | public static com.deep007.mitmproxyjava.VoidResponse parseDelimitedFrom(
177 | java.io.InputStream input,
178 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
179 | throws java.io.IOException {
180 | return com.google.protobuf.GeneratedMessageV3
181 | .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
182 | }
183 | public static com.deep007.mitmproxyjava.VoidResponse parseFrom(
184 | com.google.protobuf.CodedInputStream input)
185 | throws java.io.IOException {
186 | return com.google.protobuf.GeneratedMessageV3
187 | .parseWithIOException(PARSER, input);
188 | }
189 | public static com.deep007.mitmproxyjava.VoidResponse parseFrom(
190 | com.google.protobuf.CodedInputStream input,
191 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
192 | throws java.io.IOException {
193 | return com.google.protobuf.GeneratedMessageV3
194 | .parseWithIOException(PARSER, input, extensionRegistry);
195 | }
196 |
197 | public Builder newBuilderForType() { return newBuilder(); }
198 | public static Builder newBuilder() {
199 | return DEFAULT_INSTANCE.toBuilder();
200 | }
201 | public static Builder newBuilder(com.deep007.mitmproxyjava.VoidResponse prototype) {
202 | return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
203 | }
204 | public Builder toBuilder() {
205 | return this == DEFAULT_INSTANCE
206 | ? new Builder() : new Builder().mergeFrom(this);
207 | }
208 |
209 | @java.lang.Override
210 | protected Builder newBuilderForType(
211 | com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
212 | Builder builder = new Builder(parent);
213 | return builder;
214 | }
215 | /**
216 | * Protobuf type {@code mitm.VoidResponse}
217 | */
218 | public static final class Builder extends
219 | com.google.protobuf.GeneratedMessageV3.Builder20 | *java、go、c++客户端回调server实现,它接收mitmproxy流量的回调,修改并返回给python端 21 | *22 | */ 23 | @javax.annotation.Generated( 24 | value = "by gRPC proto compiler (version 1.15.0)", 25 | comments = "Source: mitm_hub_client.proto") 26 | public final class MitmProxyHubClientServerGrpc { 27 | 28 | private MitmProxyHubClientServerGrpc() {} 29 | 30 | public static final String SERVICE_NAME = "mitm.MitmProxyHubClientServer"; 31 | 32 | // Static method descriptors that strictly reflect the proto. 33 | private static volatile io.grpc.MethodDescriptor
122 | *java、go、c++客户端回调server实现,它接收mitmproxy流量的回调,修改并返回给python端 123 | *124 | */ 125 | public static abstract class MitmProxyHubClientServerImplBase implements io.grpc.BindableService { 126 | 127 | /** 128 | */ 129 | public void onMitmRequest(com.deep007.mitmproxyjava.MitmRequest request, 130 | io.grpc.stub.StreamObserver
163 | *java、go、c++客户端回调server实现,它接收mitmproxy流量的回调,修改并返回给python端 164 | *165 | */ 166 | public static final class MitmProxyHubClientServerStub extends io.grpc.stub.AbstractStub
201 | *java、go、c++客户端回调server实现,它接收mitmproxy流量的回调,修改并返回给python端 202 | *203 | */ 204 | public static final class MitmProxyHubClientServerBlockingStub extends io.grpc.stub.AbstractStub
237 | *java、go、c++客户端回调server实现,它接收mitmproxy流量的回调,修改并返回给python端 238 | *239 | */ 240 | public static final class MitmProxyHubClientServerFutureStub extends io.grpc.stub.AbstractStub
20 | *MitmProxyHubServer负责启动mitmproxy和通知回调client端 21 | *22 | */ 23 | @javax.annotation.Generated( 24 | value = "by gRPC proto compiler (version 1.15.0)", 25 | comments = "Source: mitm_hub_client.proto") 26 | public final class MitmProxyHubServerGrpc { 27 | 28 | private MitmProxyHubServerGrpc() {} 29 | 30 | public static final String SERVICE_NAME = "mitm.MitmProxyHubServer"; 31 | 32 | // Static method descriptors that strictly reflect the proto. 33 | private static volatile io.grpc.MethodDescriptor
122 | *MitmProxyHubServer负责启动mitmproxy和通知回调client端 123 | *124 | */ 125 | public static abstract class MitmProxyHubServerImplBase implements io.grpc.BindableService { 126 | 127 | /** 128 | */ 129 | public void start(com.deep007.mitmproxyjava.MitmproxyStartRequest request, 130 | io.grpc.stub.StreamObserver
163 | *MitmProxyHubServer负责启动mitmproxy和通知回调client端 164 | *165 | */ 166 | public static final class MitmProxyHubServerStub extends io.grpc.stub.AbstractStub
201 | *MitmProxyHubServer负责启动mitmproxy和通知回调client端 202 | *203 | */ 204 | public static final class MitmProxyHubServerBlockingStub extends io.grpc.stub.AbstractStub
237 | *MitmProxyHubServer负责启动mitmproxy和通知回调client端 238 | *239 | */ 240 | public static final class MitmProxyHubServerFutureStub extends io.grpc.stub.AbstractStub
This class is not thread-safe. Unless otherwise stated, all calls to public methods should be 39 | * made in the deframing thread. 40 | */ 41 | @NotThreadSafe 42 | public class MessageDeframer implements Closeable, Deframer { 43 | private static final int HEADER_LENGTH = 5; 44 | private static final int COMPRESSED_FLAG_MASK = 1; 45 | private static final int RESERVED_MASK = 0xFE; 46 | private static final int MAX_BUFFER_SIZE = 1024 * 1024 * 2; 47 | 48 | /** 49 | * A listener of deframing events. These methods will be invoked from the deframing thread. 50 | */ 51 | public interface Listener { 52 | 53 | /** 54 | * Called when the given number of bytes has been read from the input source of the deframer. 55 | * This is typically used to indicate to the underlying transport that more data can be 56 | * accepted. 57 | * 58 | * @param numBytes the number of bytes read from the deframer's input source. 59 | */ 60 | void bytesRead(int numBytes); 61 | 62 | /** 63 | * Called to deliver the next complete message. 64 | * 65 | * @param producer single message producer wrapping the message. 66 | */ 67 | void messagesAvailable(StreamListener.MessageProducer producer); 68 | 69 | /** 70 | * Called when the deframer closes. 71 | * 72 | * @param hasPartialMessage whether the deframer contained an incomplete message at closing. 73 | */ 74 | void deframerClosed(boolean hasPartialMessage); 75 | 76 | /** 77 | * Called when a {@link #deframe(ReadableBuffer)} operation failed. 78 | * 79 | * @param cause the actual failure 80 | */ 81 | void deframeFailed(Throwable cause); 82 | } 83 | 84 | private enum State { 85 | HEADER, BODY 86 | } 87 | 88 | private Listener listener; 89 | private int maxInboundMessageSize; 90 | private final StatsTraceContext statsTraceCtx; 91 | private final TransportTracer transportTracer; 92 | private Decompressor decompressor; 93 | private GzipInflatingBuffer fullStreamDecompressor; 94 | private byte[] inflatedBuffer; 95 | private int inflatedIndex; 96 | private State state = State.HEADER; 97 | private int requiredLength = HEADER_LENGTH; 98 | private boolean compressedFlag; 99 | private CompositeReadableBuffer nextFrame; 100 | private CompositeReadableBuffer unprocessed = new CompositeReadableBuffer(); 101 | private long pendingDeliveries; 102 | private boolean inDelivery = false; 103 | private int currentMessageSeqNo = -1; 104 | private int inboundBodyWireSize; 105 | 106 | private boolean closeWhenComplete = false; 107 | private volatile boolean stopDelivery = false; 108 | 109 | /** 110 | * Create a deframer. 111 | * 112 | * @param listener listener for deframer events. 113 | * @param decompressor the compression used if a compressed frame is encountered, with 114 | * {@code NONE} meaning unsupported 115 | * @param maxMessageSize the maximum allowed size for received messages. 116 | */ 117 | public MessageDeframer( 118 | Listener listener, 119 | Decompressor decompressor, 120 | int maxMessageSize, 121 | StatsTraceContext statsTraceCtx, 122 | TransportTracer transportTracer) { 123 | this.listener = checkNotNull(listener, "sink"); 124 | this.decompressor = checkNotNull(decompressor, "decompressor"); 125 | this.maxInboundMessageSize = maxMessageSize * 10; 126 | this.statsTraceCtx = checkNotNull(statsTraceCtx, "statsTraceCtx"); 127 | this.transportTracer = checkNotNull(transportTracer, "transportTracer"); 128 | } 129 | 130 | void setListener(Listener listener) { 131 | this.listener = listener; 132 | } 133 | 134 | @Override 135 | public void setMaxInboundMessageSize(int messageSize) { 136 | maxInboundMessageSize = messageSize; 137 | } 138 | 139 | @Override 140 | public void setDecompressor(Decompressor decompressor) { 141 | checkState(fullStreamDecompressor == null, "Already set full stream decompressor"); 142 | this.decompressor = checkNotNull(decompressor, "Can't pass an empty decompressor"); 143 | } 144 | 145 | @Override 146 | public void setFullStreamDecompressor(GzipInflatingBuffer fullStreamDecompressor) { 147 | checkState(decompressor == Codec.Identity.NONE, "per-message decompressor already set"); 148 | checkState(this.fullStreamDecompressor == null, "full stream decompressor already set"); 149 | this.fullStreamDecompressor = 150 | checkNotNull(fullStreamDecompressor, "Can't pass a null full stream decompressor"); 151 | unprocessed = null; 152 | } 153 | 154 | @Override 155 | public void request(int numMessages) { 156 | checkArgument(numMessages > 0, "numMessages must be > 0"); 157 | if (isClosed()) { 158 | return; 159 | } 160 | pendingDeliveries += numMessages; 161 | deliver(); 162 | } 163 | 164 | @Override 165 | public void deframe(ReadableBuffer data) { 166 | checkNotNull(data, "data"); 167 | boolean needToCloseData = true; 168 | try { 169 | if (!isClosedOrScheduledToClose()) { 170 | if (fullStreamDecompressor != null) { 171 | fullStreamDecompressor.addGzippedBytes(data); 172 | } else { 173 | unprocessed.addBuffer(data); 174 | } 175 | needToCloseData = false; 176 | 177 | deliver(); 178 | } 179 | } finally { 180 | if (needToCloseData) { 181 | data.close(); 182 | } 183 | } 184 | } 185 | 186 | @Override 187 | public void closeWhenComplete() { 188 | if (isClosed()) { 189 | return; 190 | } else if (isStalled()) { 191 | close(); 192 | } else { 193 | closeWhenComplete = true; 194 | } 195 | } 196 | 197 | /** 198 | * Sets a flag to interrupt delivery of any currently queued messages. This may be invoked outside 199 | * of the deframing thread, and must be followed by a call to {@link #close()} in the deframing 200 | * thread. Without a subsequent call to {@link #close()}, the deframer may hang waiting for 201 | * additional messages before noticing that the {@code stopDelivery} flag has been set. 202 | */ 203 | void stopDelivery() { 204 | stopDelivery = true; 205 | } 206 | 207 | @Override 208 | public void close() { 209 | if (isClosed()) { 210 | return; 211 | } 212 | boolean hasPartialMessage = nextFrame != null && nextFrame.readableBytes() > 0; 213 | try { 214 | if (fullStreamDecompressor != null) { 215 | hasPartialMessage = hasPartialMessage || fullStreamDecompressor.hasPartialData(); 216 | fullStreamDecompressor.close(); 217 | } 218 | if (unprocessed != null) { 219 | unprocessed.close(); 220 | } 221 | if (nextFrame != null) { 222 | nextFrame.close(); 223 | } 224 | } finally { 225 | fullStreamDecompressor = null; 226 | unprocessed = null; 227 | nextFrame = null; 228 | } 229 | listener.deframerClosed(hasPartialMessage); 230 | } 231 | 232 | /** 233 | * Indicates whether or not this deframer has been closed. 234 | */ 235 | public boolean isClosed() { 236 | return unprocessed == null && fullStreamDecompressor == null; 237 | } 238 | 239 | /** Returns true if this deframer has already been closed or scheduled to close. */ 240 | private boolean isClosedOrScheduledToClose() { 241 | return isClosed() || closeWhenComplete; 242 | } 243 | 244 | private boolean isStalled() { 245 | if (fullStreamDecompressor != null) { 246 | return fullStreamDecompressor.isStalled(); 247 | } else { 248 | return unprocessed.readableBytes() == 0; 249 | } 250 | } 251 | 252 | /** 253 | * Reads and delivers as many messages to the listener as possible. 254 | */ 255 | private void deliver() { 256 | // We can have reentrancy here when using a direct executor, triggered by calls to 257 | // request more messages. This is safe as we simply loop until pendingDelivers = 0 258 | if (inDelivery) { 259 | return; 260 | } 261 | inDelivery = true; 262 | try { 263 | // Process the uncompressed bytes. 264 | while (!stopDelivery && pendingDeliveries > 0 && readRequiredBytes()) { 265 | switch (state) { 266 | case HEADER: 267 | processHeader(); 268 | break; 269 | case BODY: 270 | // Read the body and deliver the message. 271 | processBody(); 272 | 273 | // Since we've delivered a message, decrement the number of pending 274 | // deliveries remaining. 275 | pendingDeliveries--; 276 | break; 277 | default: 278 | throw new AssertionError("Invalid state: " + state); 279 | } 280 | } 281 | 282 | if (stopDelivery) { 283 | close(); 284 | return; 285 | } 286 | 287 | /* 288 | * We are stalled when there are no more bytes to process. This allows delivering errors as 289 | * soon as the buffered input has been consumed, independent of whether the application 290 | * has requested another message. At this point in the function, either all frames have been 291 | * delivered, or unprocessed is empty. If there is a partial message, it will be inside next 292 | * frame and not in unprocessed. If there is extra data but no pending deliveries, it will 293 | * be in unprocessed. 294 | */ 295 | if (closeWhenComplete && isStalled()) { 296 | close(); 297 | } 298 | } finally { 299 | inDelivery = false; 300 | } 301 | } 302 | 303 | /** 304 | * Attempts to read the required bytes into nextFrame. 305 | * 306 | * @return {@code true} if all of the required bytes have been read. 307 | */ 308 | private boolean readRequiredBytes() { 309 | int totalBytesRead = 0; 310 | int deflatedBytesRead = 0; 311 | try { 312 | if (nextFrame == null) { 313 | nextFrame = new CompositeReadableBuffer(); 314 | } 315 | 316 | // Read until the buffer contains all the required bytes. 317 | int missingBytes; 318 | while ((missingBytes = requiredLength - nextFrame.readableBytes()) > 0) { 319 | if (fullStreamDecompressor != null) { 320 | try { 321 | if (inflatedBuffer == null || inflatedIndex == inflatedBuffer.length) { 322 | inflatedBuffer = new byte[Math.min(missingBytes, MAX_BUFFER_SIZE)]; 323 | inflatedIndex = 0; 324 | } 325 | int bytesToRead = Math.min(missingBytes, inflatedBuffer.length - inflatedIndex); 326 | int n = fullStreamDecompressor.inflateBytes(inflatedBuffer, inflatedIndex, bytesToRead); 327 | totalBytesRead += fullStreamDecompressor.getAndResetBytesConsumed(); 328 | deflatedBytesRead += fullStreamDecompressor.getAndResetDeflatedBytesConsumed(); 329 | if (n == 0) { 330 | // No more inflated data is available. 331 | return false; 332 | } 333 | nextFrame.addBuffer(ReadableBuffers.wrap(inflatedBuffer, inflatedIndex, n)); 334 | inflatedIndex += n; 335 | } catch (IOException e) { 336 | throw new RuntimeException(e); 337 | } catch (DataFormatException e) { 338 | throw new RuntimeException(e); 339 | } 340 | } else { 341 | if (unprocessed.readableBytes() == 0) { 342 | // No more data is available. 343 | return false; 344 | } 345 | int toRead = Math.min(missingBytes, unprocessed.readableBytes()); 346 | totalBytesRead += toRead; 347 | nextFrame.addBuffer(unprocessed.readBytes(toRead)); 348 | } 349 | } 350 | return true; 351 | } finally { 352 | if (totalBytesRead > 0) { 353 | listener.bytesRead(totalBytesRead); 354 | if (state == State.BODY) { 355 | if (fullStreamDecompressor != null) { 356 | // With compressed streams, totalBytesRead can include gzip header and trailer metadata 357 | statsTraceCtx.inboundWireSize(deflatedBytesRead); 358 | inboundBodyWireSize += deflatedBytesRead; 359 | } else { 360 | statsTraceCtx.inboundWireSize(totalBytesRead); 361 | inboundBodyWireSize += totalBytesRead; 362 | } 363 | } 364 | } 365 | } 366 | } 367 | 368 | /** 369 | * Processes the GRPC compression header which is composed of the compression flag and the outer 370 | * frame length. 371 | */ 372 | private void processHeader() { 373 | int type = nextFrame.readUnsignedByte(); 374 | if ((type & RESERVED_MASK) != 0) { 375 | throw Status.INTERNAL.withDescription( 376 | "gRPC frame header malformed: reserved bits not zero") 377 | .asRuntimeException(); 378 | } 379 | compressedFlag = (type & COMPRESSED_FLAG_MASK) != 0; 380 | 381 | // Update the required length to include the length of the frame. 382 | requiredLength = nextFrame.readInt(); 383 | if (requiredLength < 0 || requiredLength > maxInboundMessageSize) { 384 | throw Status.RESOURCE_EXHAUSTED.withDescription( 385 | String.format("gRPC message exceeds maximum size %d: %d", 386 | maxInboundMessageSize, requiredLength)) 387 | .asRuntimeException(); 388 | } 389 | 390 | currentMessageSeqNo++; 391 | statsTraceCtx.inboundMessage(currentMessageSeqNo); 392 | transportTracer.reportMessageReceived(); 393 | // Continue reading the frame body. 394 | state = State.BODY; 395 | } 396 | 397 | /** 398 | * Processes the GRPC message body, which depending on frame header flags may be compressed. 399 | */ 400 | private void processBody() { 401 | // There is no reliable way to get the uncompressed size per message when it's compressed, 402 | // because the uncompressed bytes are provided through an InputStream whose total size is 403 | // unknown until all bytes are read, and we don't know when it happens. 404 | statsTraceCtx.inboundMessageRead(currentMessageSeqNo, inboundBodyWireSize, -1); 405 | inboundBodyWireSize = 0; 406 | InputStream stream = compressedFlag ? getCompressedBody() : getUncompressedBody(); 407 | nextFrame = null; 408 | listener.messagesAvailable(new SingleMessageProducer(stream)); 409 | 410 | // Done with this frame, begin processing the next header. 411 | state = State.HEADER; 412 | requiredLength = HEADER_LENGTH; 413 | } 414 | 415 | private InputStream getUncompressedBody() { 416 | statsTraceCtx.inboundUncompressedSize(nextFrame.readableBytes()); 417 | return ReadableBuffers.openStream(nextFrame, true); 418 | } 419 | 420 | private InputStream getCompressedBody() { 421 | if (decompressor == Codec.Identity.NONE) { 422 | throw Status.INTERNAL.withDescription( 423 | "Can't decode compressed gRPC message as compression not configured") 424 | .asRuntimeException(); 425 | } 426 | 427 | try { 428 | // Enforce the maxMessageSize limit on the returned stream. 429 | InputStream unlimitedStream = 430 | decompressor.decompress(ReadableBuffers.openStream(nextFrame, true)); 431 | return new SizeEnforcingInputStream( 432 | unlimitedStream, maxInboundMessageSize, statsTraceCtx); 433 | } catch (IOException e) { 434 | throw new RuntimeException(e); 435 | } 436 | } 437 | 438 | /** 439 | * An {@link InputStream} that enforces the {@link #maxMessageSize} limit for compressed frames. 440 | */ 441 | @VisibleForTesting 442 | static final class SizeEnforcingInputStream extends FilterInputStream { 443 | private final int maxMessageSize; 444 | private final StatsTraceContext statsTraceCtx; 445 | private long maxCount; 446 | private long count; 447 | private long mark = -1; 448 | 449 | SizeEnforcingInputStream(InputStream in, int maxMessageSize, StatsTraceContext statsTraceCtx) { 450 | super(in); 451 | this.maxMessageSize = maxMessageSize; 452 | this.statsTraceCtx = statsTraceCtx; 453 | } 454 | 455 | @Override 456 | public int read() throws IOException { 457 | int result = in.read(); 458 | if (result != -1) { 459 | count++; 460 | } 461 | verifySize(); 462 | reportCount(); 463 | return result; 464 | } 465 | 466 | @Override 467 | public int read(byte[] b, int off, int len) throws IOException { 468 | int result = in.read(b, off, len); 469 | if (result != -1) { 470 | count += result; 471 | } 472 | verifySize(); 473 | reportCount(); 474 | return result; 475 | } 476 | 477 | @Override 478 | public long skip(long n) throws IOException { 479 | long result = in.skip(n); 480 | count += result; 481 | verifySize(); 482 | reportCount(); 483 | return result; 484 | } 485 | 486 | @Override 487 | public synchronized void mark(int readlimit) { 488 | in.mark(readlimit); 489 | mark = count; 490 | // it's okay to mark even if mark isn't supported, as reset won't work 491 | } 492 | 493 | @Override 494 | public synchronized void reset() throws IOException { 495 | if (!in.markSupported()) { 496 | throw new IOException("Mark not supported"); 497 | } 498 | if (mark == -1) { 499 | throw new IOException("Mark not set"); 500 | } 501 | 502 | in.reset(); 503 | count = mark; 504 | } 505 | 506 | private void reportCount() { 507 | if (count > maxCount) { 508 | statsTraceCtx.inboundUncompressedSize(count - maxCount); 509 | maxCount = count; 510 | } 511 | } 512 | 513 | private void verifySize() { 514 | if (count > maxMessageSize) { 515 | throw Status.RESOURCE_EXHAUSTED.withDescription(String.format( 516 | "Compressed gRPC message exceeds maximum size %d: %d bytes read", 517 | maxMessageSize, count)).asRuntimeException(); 518 | } 519 | } 520 | } 521 | 522 | private static class SingleMessageProducer implements StreamListener.MessageProducer { 523 | private InputStream message; 524 | 525 | private SingleMessageProducer(InputStream message) { 526 | this.message = message; 527 | } 528 | 529 | @Nullable 530 | @Override 531 | public InputStream next() { 532 | InputStream messageToReturn = message; 533 | message = null; 534 | return messageToReturn; 535 | } 536 | } 537 | } 538 | -------------------------------------------------------------------------------- /src/main/resources/mitm_hub_client.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | //把proto文件拷贝到resources根目录,然后项目下执行mvn clean compile生成grpc java代码 4 | option java_package = "com.deep007.mitmproxyjava"; 5 | option java_outer_classname = "MitmProxyHubClientServerProto"; 6 | option java_multiple_files = true; 7 | 8 | package mitm; 9 | 10 | 11 | //MitmProxyHubServer负责启动mitmproxy和通知回调client端 12 | service MitmProxyHubServer { 13 | rpc start(MitmproxyStartRequest) returns (MitmproxyStartResponse) {} 14 | rpc stop(MitmproxyStopRequest) returns (VoidResponse) {} 15 | } 16 | 17 | //java、go、c++客户端回调server实现,它接收mitmproxy流量的回调,修改并返回给python端 18 | service MitmProxyHubClientServer { 19 | rpc onMitmRequest(MitmRequest) returns (MitmRequest) {} 20 | rpc onMitmResponse(MitmResponse) returns (MitmResponse) {} 21 | } 22 | 23 | message VoidResponse {} 24 | 25 | message MitmproxyStartRequest { 26 | string bind = 1; 27 | int32 port = 2; 28 | string callbackServerAddr = 3; 29 | int32 callbackServerPort = 4; 30 | string upstream = 5; 31 | string upstreamAuth = 6; 32 | } 33 | 34 | message MitmproxyStartResponse { 35 | string mitmproxyId = 1; 36 | } 37 | 38 | message MitmproxyStopRequest { 39 | string mitmproxyId = 1; 40 | } 41 | 42 | message MitmHeader { 43 | string name = 1; 44 | string value = 2; 45 | } 46 | 47 | message MitmRequest { 48 | string url = 1; 49 | string method = 2; 50 | repeated MitmHeader headers = 3; 51 | bytes content = 4; 52 | string mitmproxyId = 5; 53 | } 54 | 55 | message MitmResponse { 56 | MitmRequest request = 1; 57 | repeated MitmHeader headers = 2; 58 | bytes content = 3; 59 | int32 statusCode = 4; 60 | string mitmproxyId = 5; 61 | } --------------------------------------------------------------------------------