diff --git a/.classpath b/.classpath
index ebde520..a896564 100644
--- a/.classpath
+++ b/.classpath
@@ -13,7 +13,7 @@
-
+
@@ -23,5 +23,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.gitignore b/.gitignore
index b83d222..ff60d29 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,3 @@
/target/
+./target/
+target/
\ No newline at end of file
diff --git a/.gitpod.yml b/.gitpod.yml
new file mode 100644
index 0000000..4efa528
--- /dev/null
+++ b/.gitpod.yml
@@ -0,0 +1,10 @@
+# This configuration file was automatically generated by Gitpod.
+# Please adjust to your needs (see https://www.gitpod.io/docs/introduction/learn-gitpod/gitpod-yaml)
+# and commit this file to your remote git repository to share the goodness with others.
+
+# Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart
+
+tasks:
+ - init: mvn install -DskipTests=false
+
+
diff --git a/.project b/.project
index 8ae7f3d..887fd79 100644
--- a/.project
+++ b/.project
@@ -20,4 +20,15 @@
org.eclipse.jdt.core.javanature
org.eclipse.m2e.core.maven2Nature
+
+
+ 1732157035936
+
+ 30
+
+ org.eclipse.core.resources.regexFilterMatcher
+ node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
+
+
+
diff --git a/.settings/org.eclipse.jdt.apt.core.prefs b/.settings/org.eclipse.jdt.apt.core.prefs
new file mode 100644
index 0000000..d4313d4
--- /dev/null
+++ b/.settings/org.eclipse.jdt.apt.core.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.apt.aptEnabled=false
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
index 5723a0f..1b6e1ef 100644
--- a/.settings/org.eclipse.jdt.core.prefs
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -1,8 +1,9 @@
eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
+org.eclipse.jdt.core.compiler.processAnnotations=disabled
org.eclipse.jdt.core.compiler.release=disabled
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/README.md b/README.md
index 9af5825..3dc5d00 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,7 @@
Que deus me ajude a terminar no natal kkk!!!
## Referencias
- [WikiBitTorrent](https://wiki.theory.org/index.php/Main_Page)
+ [WikiBitTorrent](https://wiki.theory.org/Main_Page)
diff --git a/src/main/java/org/voyager/torrent/Main.java b/src/main/java/org/voyager/torrent/Main.java
index 6475afd..e0329e0 100644
--- a/src/main/java/org/voyager/torrent/Main.java
+++ b/src/main/java/org/voyager/torrent/Main.java
@@ -1,16 +1,13 @@
package org.voyager.torrent;
-import java.io.File;
-
import org.voyager.torrent.client.ClientTorrent;
-import org.voyager.torrent.util.ReaderBencode;
import GivenTools.BencodingException;
public class Main {
public static void main(String[] args) {
- ClientTorrent mytorrent = new ClientTorrent();
+ ClientTorrent mytorrent = new ClientTorrent(true);
mytorrent.addTorentFile("./netinst.torrent");
try {
mytorrent.start();
diff --git a/src/main/java/org/voyager/torrent/client/ClientTorrent.java b/src/main/java/org/voyager/torrent/client/ClientTorrent.java
index ce61d54..d767083 100644
--- a/src/main/java/org/voyager/torrent/client/ClientTorrent.java
+++ b/src/main/java/org/voyager/torrent/client/ClientTorrent.java
@@ -1,50 +1,43 @@
package org.voyager.torrent.client;
-import java.io.BufferedReader;
-import java.io.DataOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
-import java.net.ServerSocket;
import java.net.URL;
import java.nio.ByteBuffer;
-import java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.UUID;
import org.voyager.torrent.client.connect.ManagerPeer;
import org.voyager.torrent.client.connect.Peer;
import org.voyager.torrent.util.BinaryUtil;
import org.voyager.torrent.util.HttpUtil;
+import org.voyager.torrent.util.PrintUtil;
import org.voyager.torrent.util.ReaderBencode;
-import GivenTools.Bencoder2;
import GivenTools.BencodingException;
import GivenTools.TorrentInfo;
public class ClientTorrent implements ManagerPeer{
-
+
public static String separator = System.getProperty("file.separator");
public static String dirUser = new File(System.getProperty("user.home")).getAbsolutePath()+separator;
public static String dirRuntime = "."+separator;
-
-
+
// torrent info e connets info
public TorrentInfo torrent;
+
+ private boolean verbouse;
public static int uploaded;
public static int downloaded;
-
- public ClientTorrent Build() {
- return null;
- }
-
+
+ public ClientTorrent(boolean verbouse){ this.verbouse = verbouse; }
+
public void start() throws BencodingException {
List listPeers = new ArrayList();
@@ -66,7 +59,7 @@ public void start() throws BencodingException {
parameters.put("port", "-1"); // port connect
parameters.put("downloaded", "0");
parameters.put("left", torrent.file_length+"");
- System.out.println(torrent.announce_url);
+ System.out.println(" Announce URL: "+ torrent.announce_url);
URL url_announce = new URL(torrent.announce_url+"?"+HttpUtil.getParamsString(parameters));
@@ -78,12 +71,11 @@ public void start() throws BencodingException {
// read response
StringBuffer res = BinaryUtil.inputStreamReaderToStringBuffer( new InputStreamReader(con.getInputStream()) );
- //System.out.println(res);
-
+
Map map = ReaderBencode.bencodeToMap(res);
int interval = (Integer) map.get( BinaryUtil.stringToByteBuffer("interval") );
- System.out.println( interval );
+
List