Exemplo n.º 1
0
import (
	"net"
	"sync"
	"testing"
	"time"

	"github.com/getlantern/golog"
	"github.com/getlantern/testify/assert"
	"github.com/getlantern/waddell"
)

const (
	MessageText = "Hello World"

	TestTopic = waddell.TopicId(9000)
)

var tlog = golog.LoggerFor("natty-test")

func TestTimeout(t *testing.T) {
	offer := Offer(1 * time.Millisecond)
	_, err := offer.FiveTuple()
	assert.Error(t, err, "There should be an error")
	if err != nil {
		assert.Contains(t, err.Error(), "Timed out", "Error should mention timing out")
	}
}

// TestDirect starts up two local Traversals that communicate with each other
// directly.  Once connected, one peer sends a UDP packet to the other to make
Exemplo n.º 2
0
	"log"
	"net"
	"time"

	"github.com/getlantern/waddell"
)

const (
	// TODO: figure out maximum required size for messages
	MAX_MESSAGE_SIZE = 4096

	READY = "READY"

	TIMEOUT = 15 * time.Second

	DemoTopic = waddell.TopicId(10000)
)

var (
	endianness = binary.LittleEndian

	help        = flag.Bool("help", false, "Get usage help")
	mode        = flag.String("mode", "client", "client or server. Client initiates the NAT traversal. Defaults to client.")
	waddellAddr = flag.String("waddell", "128.199.130.61:443", "Address of waddell signaling server, defaults to 128.199.130.61:443")
	waddellCert = flag.String("waddellcert", DefaultWaddellCert, "Certificate for waddell server")

	wc  *waddell.Client
	id  waddell.PeerId
	out chan<- *waddell.MessageOut
	in  <-chan *waddell.MessageIn
)