Files
KLALB/src/org/kne/cloud/network/klalb/KLALBClient.java
T
2022-11-25 21:06:10 +08:00

67 lines
1.9 KiB
Java

package org.kne.cloud.network.klalb;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
public class KLALBClient {
private List<Tunnel> tls=new ArrayList<>();
private TCPListener tcpl;
public KLALBClient(int port) throws IOException {
tcpl=new TCPListener(port);
tcpl.setCon((s)->{
KLALBClientProtocol kcp=new KLALBClientProtocol(tls);
try {
kcp.setIn(new BufferedInputStream(s.getInputStream(),8192));
kcp.setOut(new BufferedOutputStream(s.getOutputStream(),8192));
kcp.startLocal();
kcp.runProtocol();
} catch (IOException e) {
e.printStackTrace();
}
});
}
public void open() throws IOException {
tcpl.open();
}
public List<Tunnel> getTls() {
return tls;
}
public static void main(String[] args) throws IOException {
KLALBClient kc=new KLALBClient(4568);
//Tunnel t= new Tunnel("Test1", "127.0.0.1", 4569);
/*Tunnel t= new Tunnel("Test1", "cn-hz-bgp-1.openfrp.top", 65529);
tls.add(t);
Tunnel t2=new Tunnel("Test2","cn-bj-bgp-3.openfrp.top",65529);
tls.add(t2);
Tunnel t3=new Tunnel("Test3","180.76.147.250",65529);
tls.add(t3);
Tunnel t4=new Tunnel("Test4","cn-sx-xa-bgp-1.openfrp.top",65529);
tls.add(t4);
*/
List<Tunnel> tls=kc.getTls();
Tunnel t5=new Tunnel("Test5","la.afrps.cn",49966);
tls.add(t5);
Tunnel t6=new Tunnel("Test6","sg.afrps.cn",49966);
tls.add(t6);
Tunnel t7=new Tunnel("Test7","ch.afrps.cn",49966);
tls.add(t7);
Tunnel t8=new Tunnel("Test8","sj.afrps.cn",49966);
tls.add(t8);
Tunnel t9=new Tunnel("Test9","frp.104300.xyz",49965);
tls.add(t9);
Tunnel t11=new Tunnel("Test11","153.36.240.12",65529);
tls.add(t11);
Tunnel t12=new Tunnel("Test12","frp.freefrps.com",49965);
tls.add(t12);
kc.open();
}
}