Documentation ¶
Index ¶
- Constants
- func P2PAddrFromString(c string) (*peer.AddrInfo, error)
- type IPFS
- func (p2p *IPFS) Find(ns string)
- func (p2p *IPFS) InitEvent()
- func (p2p *IPFS) InterceptAccept(multiaddrs network.ConnMultiaddrs) (allow bool)
- func (p2p *IPFS) InterceptAddrDial(id peer.ID, m multiaddr.Multiaddr) (allow bool)
- func (p2p *IPFS) InterceptPeerDial(p peer.ID) (allow bool)
- func (p2p *IPFS) InterceptSecured(direction network.Direction, id peer.ID, multiaddrs network.ConnMultiaddrs) (allow bool)
- func (p2p *IPFS) InterceptUpgraded(conn network.Conn) (allow bool, reason control.DisconnectReason)
- func (p2p *IPFS) Provide(ns string) error
- func (p2p *IPFS) Put(key ed25519.PrivateKey, v []byte, seq uint64, exp time.Duration) (string, error)
- func (p2p *IPFS) ServeHTTP(w http.ResponseWriter, r *http.Request)
- type IPFSConfig
- type PeeringService
Constants ¶
const Protocol = "/ugate/0.0.1"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type IPFS ¶
type IPFS struct { *IPFSConfig Host host.Host // Only set for discovery nodes. // Mobile/battery powered/clients use Routing DHT *dht.IpfsDHT // Combines ContentRouting, PeerRouting, ValueStore Routing routing.Routing // may be same as DHT // contains filtered or unexported fields }
ConnectionGater, Server
func InitIPFS ¶
InitIPFS creates LibP2P compatible transport. Identity is based on the EC256 workload identity in auth.
Will use a select set of transports, remotely based on standards: - QUIC - WS
UGate implements H2, WebRTC variants, with a IPFS transport adapter.
func (*IPFS) InterceptAccept ¶
func (p2p *IPFS) InterceptAccept(multiaddrs network.ConnMultiaddrs) (allow bool)
func (*IPFS) InterceptAddrDial ¶
func (*IPFS) InterceptSecured ¶
func (*IPFS) InterceptUpgraded ¶
func (*IPFS) Provide ¶
Announce this node is a provider for the key. Normally used for IPFS, key is the sha of the content. Also used for advertise, in Discovery and autorelay.go (/libp2p/relay) According to routing.go, 24h is the normal validity, recommended 6hours refresh.
type IPFSConfig ¶
type IPFSConfig struct { // If true enable the DHT functionality. // In this mode, we act as 'control plane'. If false, the node acts // as a gateway, using a CP for discovery and control. // The DHT requires maintaining a lot of connections, best for an internet // connected host - not for mobile. UseDHT bool }
type PeeringService ¶
type PeeringService struct {
// contains filtered or unexported fields
}
PeeringService maintains connections to specified peers, reconnecting on disconnect with a back-off.
func NewPeeringService ¶
func NewPeeringService(host host.Host) *PeeringService
NewPeeringService constructs a new peering service. Peers can be added and removed immediately, but connections won't be formed until `Start` is called.
func (*PeeringService) AddPeer ¶
func (ps *PeeringService) AddPeer(info peer.AddrInfo)
AddPeer adds a peer to the peering service. This function may be safely called at any time: before the service is started, while running, or after it stops.
Add peer may also be called multiple times for the same peer. The new addresses will replace the old.
func (*PeeringService) RemovePeer ¶
func (ps *PeeringService) RemovePeer(id peer.ID)
RemovePeer removes a peer from the peering service. This function may be safely called at any time: before the service is started, while running, or after it stops.
func (*PeeringService) Start ¶
func (ps *PeeringService) Start() error
Start starts the peering service, connecting and maintaining connections to all registered peers. It returns an error if the service has already been stopped.
func (*PeeringService) Stop ¶
func (ps *PeeringService) Stop() error
Stop stops the peering service.