Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a webrtc test #49

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 106 additions & 0 deletions ping/_compositions/go-webrtc.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
[metadata]
name = "go-webrtc {{ .Env.GitReference }}"

[global]
plan = "libp2p/ping/go"
case = "ping"
builder = "docker:go"
runner = "local:docker"

[global.build_config]
enable_go_build_cache = false # see https://github.com/testground/testground/issues/1361
# disable testground's goproxy which hangs on github runners.
go_proxy_mode = "remote"
go_proxy_url = "https://proxy.golang.org"

{{ with (load_resource "./recent-go.toml" ) }}
{{ range .groups }}
[[groups]]
id = "{{ .Id }}"
instances = { count = 1 }

[groups.build]
selectors = ['{{ .Selector }}']

[groups.build_config]
build_base_image = 'golang:{{ .GoVersion }}-buster'
modfile = "{{ .Modfile }}"

[groups.build_config.dockerfile_extensions]
#TODO this violates the whole idea of going cross-version. Also, should be done, in the long run, with go.mod not git clone.
pre_mod_download = '''
RUN git clone --single-branch --branch ckousik/webrtc https://github.com/ckousik/go-libp2p.git /code/go-libp2p/
RUN cd /code/go-libp2p/ && git checkout ckousik/webrtc && git tag v1.2.7 && git branch master
'''
pre_build = """
RUN cd ${PLAN_DIR} && go mod edit -replace github.com/libp2p/go-libp2p=/code/go-libp2p/
RUN cd ${PLAN_DIR} && go mod tidy -compat={{ .GoVersion }}
"""
[groups.run.test_params]
transport = "webrtc"
{{ end }}

{{ with .master }}
[[groups]]
id = "master"
instances = { count = 1 }

[groups.build]
selectors = ['{{ .Selector }}']

[[groups.build.dependencies]]
module = "github.com/libp2p/go-libp2p"
version = "master"

[groups.build_config]
build_base_image = 'golang:{{ .GoVersion }}-buster'
modfile = "{{ .Modfile }}"

[groups.build_config.dockerfile_extensions]
pre_mod_download = '''
RUN git clone --single-branch --branch ckousik/webrtc https://github.com/ckousik/go-libp2p.git /code/go-libp2p/
RUN cd /code/go-libp2p/ && git checkout ckousik/webrtc && git tag v1.2.7 && git branch master
'''
pre_build = """
RUN cd ${PLAN_DIR} && go mod edit -replace github.com/libp2p/go-libp2p=/code/go-libp2p/
RUN cd ${PLAN_DIR} && go mod tidy -compat={{ .GoVersion }}
"""
[groups.run.test_params]
transport = "webrtc"

{{ end }}

{{ if $.Env.GitReference }}
{{ with .custom }}
[[groups]]
id = "custom"
instances = { count = 1 }

[groups.build]
selectors = ['{{ .Selector }}']

[[groups.build.dependencies]]
module = "github.com/libp2p/go-libp2p"
version = "{{ $.Env.GitReference }}"
{{ if $.Env.GitTarget }}
target = "{{ $.Env.GitTarget }}"
{{ end }}

[groups.build_config]
build_base_image = 'golang:{{ .GoVersion }}-buster'
modfile = "{{ .Modfile }}"

[groups.build_config.dockerfile_extensions]
pre_mod_download = '''
RUN git clone --single-branch --branch ckousik/webrtc https://github.com/ckousik/go-libp2p.git /code/go-libp2p/
RUN cd /code/go-libp2p/ && git checkout ckousik/webrtc && git tag v1.2.7 && git branch master
'''
pre_build = """
RUN cd ${PLAN_DIR} && go mod edit -replace github.com/libp2p/go-libp2p=/code/go-libp2p/
RUN cd ${PLAN_DIR} && go mod tidy -compat={{ .GoVersion }}
"""
[groups.run.test_params]
transport = "webrtc"
{{ end }}
{{ end }}
{{ end }}
16 changes: 16 additions & 0 deletions ping/_compositions/recent-go.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[master]
GoVersion = '1.19'
Modfile = "go.ckousik.mod"
Selector = 'ckousik'

[custom]
GoVersion = '1.19'
Modfile = "go.ckousik.mod"
Selector = 'ckousik'

[[groups]]
Id = "ckousik"
GoVersion = '1.19'
Modfile = "go.ckousik.mod"
Selector = 'ckousik'

37 changes: 37 additions & 0 deletions ping/go/compat/libp2p.ckousik.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//go:build ckousik
// +build ckousik

package compat

import (
"context"
"fmt"

"github.com/libp2p/go-libp2p"
"github.com/libp2p/go-libp2p/config"
"github.com/libp2p/go-libp2p/core/host"
"github.com/libp2p/go-libp2p/core/peer"

noise "github.com/libp2p/go-libp2p/p2p/security/noise"
tls "github.com/libp2p/go-libp2p/p2p/security/tls"
webrtc "github.com/libp2p/go-libp2p/p2p/transport/webrtc"
)

type PeerAddrInfo = peer.AddrInfo

func NewLibp2(ctx context.Context, secureChannel string, opts ...config.Option) (host.Host, error) {
security := getSecurityByName(secureChannel)
return libp2p.New(
append(opts, security, libp2p.Transport(webrtc.New))...,
)
}

func getSecurityByName(secureChannel string) libp2p.Option {
switch secureChannel {
case "noise":
return libp2p.Security(noise.ID, noise.New)
case "tls":
return libp2p.Security(tls.ID, tls.New)
}
panic(fmt.Sprintf("unknown secure channel: %s", secureChannel))
}
126 changes: 126 additions & 0 deletions ping/go/go.ckousik.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
module github.com/libp2p/test-plans/ping/go

replace github.com/libp2p/go-libp2p => /code/go-libp2p

require (
github.com/libp2p/go-libp2p v1.2.7
github.com/libp2p/go-libp2p-core v0.20.1
github.com/testground/sdk-go v0.3.0
golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde
)

require (
github.com/avast/retry-go v2.6.0+incompatible // indirect
github.com/benbjohnson/clock v1.3.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/containerd/cgroups v1.0.4 // indirect
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/elastic/gosigar v0.14.2 // indirect
github.com/flynn/noise v1.0.0 // indirect
github.com/francoispqt/gojay v1.2.13 // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/gopacket v1.1.19 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-multierror v1.1.0 // indirect
github.com/huin/goupnp v1.0.3 // indirect
github.com/influxdata/influxdb1-client v0.0.0-20200515024757-02f0bf5dbca3 // indirect
github.com/ipfs/go-cid v0.3.2 // indirect
github.com/ipfs/go-log/v2 v2.5.1 // indirect
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect
github.com/klauspost/compress v1.15.9 // indirect
github.com/klauspost/cpuid/v2 v2.1.1 // indirect
github.com/koron/go-ssdp v0.0.3 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/libp2p/go-cidranger v1.1.0 // indirect
github.com/libp2p/go-flow-metrics v0.1.0 // indirect
github.com/libp2p/go-libp2p-asn-util v0.2.0 // indirect
github.com/libp2p/go-msgio v0.2.0 // indirect
github.com/libp2p/go-nat v0.1.0 // indirect
github.com/libp2p/go-netroute v0.2.0 // indirect
github.com/libp2p/go-openssl v0.1.0 // indirect
github.com/libp2p/go-reuseport v0.2.0 // indirect
github.com/libp2p/go-yamux/v3 v3.1.2 // indirect
github.com/lucas-clemente/quic-go v0.29.0 // indirect
github.com/marten-seemann/qtls-go1-18 v0.1.2 // indirect
github.com/marten-seemann/qtls-go1-19 v0.1.0 // indirect
github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/mattn/go-pointer v0.0.1 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/miekg/dns v1.1.50 // indirect
github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect
github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc // indirect
github.com/minio/sha256-simd v1.0.0 // indirect
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/multiformats/go-base32 v0.1.0 // indirect
github.com/multiformats/go-base36 v0.1.0 // indirect
github.com/multiformats/go-multiaddr v0.6.1-0.20220825120744-e8c0913a8eb7 // indirect
github.com/multiformats/go-multiaddr-dns v0.3.1 // indirect
github.com/multiformats/go-multiaddr-fmt v0.1.0 // indirect
github.com/multiformats/go-multibase v0.1.1 // indirect
github.com/multiformats/go-multicodec v0.6.0 // indirect
github.com/multiformats/go-multihash v0.2.1 // indirect
github.com/multiformats/go-multistream v0.3.3 // indirect
github.com/multiformats/go-varint v0.0.6 // indirect
github.com/nxadm/tail v1.4.8 // indirect
github.com/onsi/ginkgo v1.16.5 // indirect
github.com/opencontainers/runtime-spec v1.0.2 // indirect
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
github.com/pion/datachannel v1.5.2 // indirect
github.com/pion/dtls/v2 v2.1.5 // indirect
github.com/pion/ice/v2 v2.2.7 // indirect
github.com/pion/interceptor v0.1.12 // indirect
github.com/pion/logging v0.2.2 // indirect
github.com/pion/mdns v0.0.5 // indirect
github.com/pion/randutil v0.1.0 // indirect
github.com/pion/rtcp v1.2.10 // indirect
github.com/pion/rtp v1.7.13 // indirect
github.com/pion/sctp v1.8.2 // indirect
github.com/pion/sdp/v3 v3.0.6 // indirect
github.com/pion/srtp/v2 v2.0.10 // indirect
github.com/pion/stun v0.3.5 // indirect
github.com/pion/transport v0.13.1 // indirect
github.com/pion/turn/v2 v2.0.8 // indirect
github.com/pion/udp v0.1.1 // indirect
github.com/pion/webrtc/v3 v3.1.43 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_golang v1.13.0 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/raulk/clock v1.1.0 // indirect
github.com/raulk/go-watchdog v1.3.0 // indirect
github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 // indirect
github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/testground/sync-service v0.1.0 // indirect
github.com/testground/testground v0.5.3 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.23.0 // indirect
golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 // indirect
golang.org/x/exp v0.0.0-20220827204233-334a2380cb91 // indirect
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b // indirect
golang.org/x/sys v0.0.0-20220829200755-d48e67d00261 // indirect
golang.org/x/tools v0.1.12 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
lukechampine.com/blake3 v1.1.7 // indirect
nhooyr.io/websocket v1.8.6 // indirect
)

go 1.19
Loading