Skip to content

Commit c0ab734

Browse files
author
Ganesh K Bhat
committed
[COMMIT] Adding interface implementation for every protocol possible. imports to be done
1 parent e77eb89 commit c0ab734

File tree

1 file changed

+246
-11
lines changed

1 file changed

+246
-11
lines changed

src/protocols.js

Lines changed: 246 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,76 +29,311 @@ function protocolInterface(config) {
2929
}
3030
}
3131

32+
33+
3234
function tcp(config) {
3335
protocolInterface.call(this, config);
36+
37+
this.connect = function () {
38+
39+
}
40+
this.disconnect = function () {
41+
42+
}
43+
this.serve = function () {
44+
45+
}
46+
this.send = function () {
47+
48+
}
49+
this.receive = function () {
50+
51+
}
3452
}
3553

3654
function tls(config) {
3755
protocolInterface.call(this, config);
56+
57+
this.connect = function () {
58+
59+
}
60+
this.disconnect = function () {
61+
62+
}
63+
this.serve = function () {
64+
65+
}
66+
this.send = function () {
67+
68+
}
69+
this.receive = function () {
70+
71+
}
3872
}
3973

4074
function udp(config) {
4175
protocolInterface.call(this, config);
76+
77+
this.connect = function () {
78+
79+
}
80+
this.disconnect = function () {
81+
82+
}
83+
this.serve = function () {
84+
85+
}
86+
this.send = function () {
87+
88+
}
89+
this.receive = function () {
90+
91+
}
4292
}
4393

4494
function socksv4(config) {
4595
protocolInterface.call(this, config);
96+
97+
this.connect = function () {
98+
99+
}
100+
this.disconnect = function () {
101+
102+
}
103+
this.serve = function () {
104+
105+
}
106+
this.send = function () {
107+
108+
}
109+
this.receive = function () {
110+
111+
}
46112
}
47113

48114
function socksv4a(config) {
49115
protocolInterface.call(this, config);
116+
117+
this.connect = function () {
118+
119+
}
120+
this.disconnect = function () {
121+
122+
}
123+
this.serve = function () {
124+
125+
}
126+
this.send = function () {
127+
128+
}
129+
this.receive = function () {
130+
131+
}
50132
}
51133

52134
function socksv5(config) {
53135
protocolInterface.call(this, config);
136+
137+
this.connect = function () {
138+
139+
}
140+
this.disconnect = function () {
141+
142+
}
143+
this.serve = function () {
144+
145+
}
146+
this.send = function () {
147+
148+
}
149+
this.receive = function () {
150+
151+
}
54152
}
55153

56154
function socks(config) {
57155
protocolInterface.call(this, config);
156+
157+
this.connect = function () {
158+
159+
}
160+
this.disconnect = function () {
161+
162+
}
163+
this.serve = function () {
164+
165+
}
166+
this.send = function () {
167+
168+
}
169+
this.receive = function () {
170+
171+
}
58172
}
59173

60174
function socket(config) {
61175
protocolInterface.call(this, config);
176+
177+
this.connect = function () {
178+
179+
}
180+
this.disconnect = function () {
181+
182+
}
183+
this.serve = function () {
184+
185+
}
186+
this.send = function () {
187+
188+
}
189+
this.receive = function () {
190+
191+
}
62192
}
63193

64194
function ftp(config) {
65195
protocolInterface.call(this, config);
196+
197+
this.connect = function () {
198+
199+
}
200+
this.disconnect = function () {
201+
202+
}
203+
this.serve = function () {
204+
205+
}
206+
this.send = function () {
207+
208+
}
209+
this.receive = function () {
210+
211+
}
66212
}
67213

68214
function ftps(config) {
69215
protocolInterface.call(this, config);
216+
217+
this.connect = function () {
218+
219+
}
220+
this.disconnect = function () {
221+
222+
}
223+
this.serve = function () {
224+
225+
}
226+
this.send = function () {
227+
228+
}
229+
this.receive = function () {
230+
231+
}
70232
}
71233

72234
function ws(config) {
73235
protocolInterface.call(this, config);
236+
237+
this.connect = function () {
238+
239+
}
240+
this.disconnect = function () {
241+
242+
}
243+
this.serve = function () {
244+
245+
}
246+
this.send = function () {
247+
248+
}
249+
this.receive = function () {
250+
251+
}
74252
}
75253

76254

77255
function handlers(config) {
78256
protocolInterface.call(this, config);
79257

80-
if (config.protocol === "udp") {
258+
let o;
81259

260+
if (config.protocol === "udp") {
261+
o = new udp(config);
262+
this.connect = o.connect;
263+
this.disconnect = o.disconnect;
264+
this.serve = o.serve;
265+
this.send = o.send;
266+
this.receive = o.receive;
82267
} else if (config.protocol === "tcp") {
83-
268+
o = new tcp(config);
269+
this.connect = o.connect;
270+
this.disconnect = o.disconnect;
271+
this.serve = o.serve;
272+
this.send = o.send;
273+
this.receive = o.receive;
84274
} else if (config.protocol === "tls") {
85-
275+
o = new tls(config);
276+
this.connect = o.connect;
277+
this.disconnect = o.disconnect;
278+
this.serve = o.serve;
279+
this.send = o.send;
280+
this.receive = o.receive;
86281
} else if (config.protocol === "ws") {
87-
282+
o = new ws(config);
283+
this.connect = o.connect;
284+
this.disconnect = o.disconnect;
285+
this.serve = o.serve;
286+
this.send = o.send;
287+
this.receive = o.receive;
88288
} else if (config.protocol === "socks") {
89-
289+
o = new socks(config);
290+
this.connect = o.connect;
291+
this.disconnect = o.disconnect;
292+
this.serve = o.serve;
293+
this.send = o.send;
294+
this.receive = o.receive;
90295
} else if (config.protocol === "SOCKSv4") {
91-
296+
o = new sockv4(config);
297+
this.connect = o.connect;
298+
this.disconnect = o.disconnect;
299+
this.serve = o.serve;
300+
this.send = o.send;
301+
this.receive = o.receive;
92302
} else if (config.protocol === "SOCKSv4a") {
93-
303+
o = new sockv4a(config);
304+
this.connect = o.connect;
305+
this.disconnect = o.disconnect;
306+
this.serve = o.serve;
307+
this.send = o.send;
308+
this.receive = o.receive;
94309
} else if (config.protocol === "SOCKSv5") {
95-
310+
o = new sockv5(config);
311+
this.connect = o.connect;
312+
this.disconnect = o.disconnect;
313+
this.serve = o.serve;
314+
this.send = o.send;
315+
this.receive = o.receive;
96316
} else if (config.protocol === "socket") {
97-
317+
o = new socket(config);
318+
this.connect = o.connect;
319+
this.disconnect = o.disconnect;
320+
this.serve = o.serve;
321+
this.send = o.send;
322+
this.receive = o.receive;
98323
} else if (config.protocol === "ftp") {
99-
324+
o = new ftp(config);
325+
this.connect = o.connect;
326+
this.disconnect = o.disconnect;
327+
this.serve = o.serve;
328+
this.send = o.send;
329+
this.receive = o.receive;
100330
} else if (config.protocol === "ftps") {
101-
331+
o = new ftps(config);
332+
this.connect = o.connect;
333+
this.disconnect = o.disconnect;
334+
this.serve = o.serve;
335+
this.send = o.send;
336+
this.receive = o.receive;
102337
}
103338

104339
return {

0 commit comments

Comments
 (0)