packages/hyprspace: add QUIC transport
This commit is contained in:
parent
e1f3681821
commit
a4b683b800
2 changed files with 7 additions and 2 deletions
|
@ -20,6 +20,7 @@ import (
|
||||||
"github.com/libp2p/go-libp2p/core/pnet"
|
"github.com/libp2p/go-libp2p/core/pnet"
|
||||||
"github.com/libp2p/go-libp2p/p2p/discovery/backoff"
|
"github.com/libp2p/go-libp2p/p2p/discovery/backoff"
|
||||||
"github.com/libp2p/go-libp2p/p2p/host/autorelay"
|
"github.com/libp2p/go-libp2p/p2p/host/autorelay"
|
||||||
|
libp2pquic "github.com/libp2p/go-libp2p/p2p/transport/quic"
|
||||||
"github.com/libp2p/go-libp2p/p2p/transport/tcp"
|
"github.com/libp2p/go-libp2p/p2p/transport/tcp"
|
||||||
ma "github.com/multiformats/go-multiaddr"
|
ma "github.com/multiformats/go-multiaddr"
|
||||||
)
|
)
|
||||||
|
@ -83,6 +84,9 @@ func CreateNode(ctx context.Context, inputKey []byte, port int, handler network.
|
||||||
maybePrivateNet = libp2p.PrivateNetwork(key)
|
maybePrivateNet = libp2p.PrivateNetwork(key)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ip6quic := fmt.Sprintf("/ip6/::/udp/%d/quic", port)
|
||||||
|
ip4quic := fmt.Sprintf("/ip4/0.0.0.0/udp/%d/quic", port)
|
||||||
|
|
||||||
ip6tcp := fmt.Sprintf("/ip6/::/tcp/%d", port)
|
ip6tcp := fmt.Sprintf("/ip6/::/tcp/%d", port)
|
||||||
ip4tcp := fmt.Sprintf("/ip4/0.0.0.0/tcp/%d", port)
|
ip4tcp := fmt.Sprintf("/ip4/0.0.0.0/tcp/%d", port)
|
||||||
|
|
||||||
|
@ -91,11 +95,12 @@ func CreateNode(ctx context.Context, inputKey []byte, port int, handler network.
|
||||||
// Create libp2p node
|
// Create libp2p node
|
||||||
node, err = libp2p.New(
|
node, err = libp2p.New(
|
||||||
maybePrivateNet,
|
maybePrivateNet,
|
||||||
libp2p.ListenAddrStrings(ip6tcp, ip4tcp),
|
libp2p.ListenAddrStrings(ip6tcp, ip4tcp, ip4quic, ip6quic),
|
||||||
libp2p.Identity(privateKey),
|
libp2p.Identity(privateKey),
|
||||||
libp2p.DefaultSecurity,
|
libp2p.DefaultSecurity,
|
||||||
libp2p.NATPortMap(),
|
libp2p.NATPortMap(),
|
||||||
libp2p.DefaultMuxers,
|
libp2p.DefaultMuxers,
|
||||||
|
libp2p.Transport(libp2pquic.NewTransport),
|
||||||
libp2p.Transport(tcp.NewTCPTransport),
|
libp2p.Transport(tcp.NewTCPTransport),
|
||||||
libp2p.EnableHolePunching(),
|
libp2p.EnableHolePunching(),
|
||||||
libp2p.EnableRelayService(),
|
libp2p.EnableRelayService(),
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
};
|
};
|
||||||
packages.hyprspace = with pkgs; buildGo118Module {
|
packages.hyprspace = with pkgs; buildGo118Module {
|
||||||
pname = "hyprspace";
|
pname = "hyprspace";
|
||||||
version = "0.3.0";
|
version = "0.3.1";
|
||||||
|
|
||||||
src = with inputs.nix-filter.lib; let
|
src = with inputs.nix-filter.lib; let
|
||||||
dirs = map inDirectory;
|
dirs = map inDirectory;
|
||||||
|
|
Loading…
Reference in a new issue