lasts
This commit is contained in:
8
main.go
8
main.go
@@ -12,14 +12,14 @@ import (
|
||||
|
||||
"github.com/libp2p/go-libp2p"
|
||||
dht "github.com/libp2p/go-libp2p-kad-dht"
|
||||
"github.com/libp2p/go-libp2p/core/host"
|
||||
// "github.com/libp2p/go-libp2p/core/host" <-- BU SATIR SİLİNDİ (Hata sebebiydi)
|
||||
"github.com/libp2p/go-libp2p/core/network"
|
||||
"github.com/libp2p/go-libp2p/core/peer"
|
||||
"github.com/libp2p/go-libp2p/p2p/discovery/routing"
|
||||
dutil "github.com/libp2p/go-libp2p/p2p/discovery/util"
|
||||
)
|
||||
|
||||
const protocolID = "/sallik/1.0.0"
|
||||
const protocolID = "/onion-chat/1.0.0"
|
||||
|
||||
func main() {
|
||||
rendezvousString := flag.String("r", "gizli-tunel-sifresi", "Buluşma noktası için gizli kelime")
|
||||
@@ -92,7 +92,7 @@ func main() {
|
||||
|
||||
// Bağlantı dene
|
||||
if err := h.Connect(ctx, peer); err != nil {
|
||||
// Bağlantı başarısız olabilir (henüz delik açılmamış olabilir), tekrar deneriz
|
||||
// Bağlantı başarısız olabilir, tekrar deneriz
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ func main() {
|
||||
rw := bufio.NewReadWriter(bufio.NewReader(stream), bufio.NewWriter(stream))
|
||||
go readData(rw)
|
||||
go writeData(rw)
|
||||
return // Bir kişi bulduk ve bağlandık, aramayı durdur (isteğe bağlı)
|
||||
return // Bir kişi bulduk ve bağlandık, aramayı durdur
|
||||
}
|
||||
time.Sleep(time.Second * 2) // Kimse yoksa 2 saniye sonra tekrar ara
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user