Skip to content

Antonito/gfile

Repository files navigation

CI Go Report Card License: MIT Mentioned in Awesome Go

GFile

gfile is a WebRTC-based file exchange tool.

It lets you share a file directly between two computers, without the need of a third party.

ezgif-5-9936f8008e4d

Note

This project is still in its early stage.

How does it work ?

Schema

The STUN server is only used to help the two clients find each other through NAT. The data you transfer with gfile does not transit through it.

More information here

For wire-format and session-protocol details, see PROTOCOL.md.

STUN configuration

gfile defaults to Google's public STUN server (stun.l.google.com:19302). You can override this with --stun:

# Use a specific STUN server
gfile --stun stun.cloudflare.com:3478 send -f filename

# Use multiple STUN servers (comma-separated)
gfile --stun stun.l.google.com:19302,stun.cloudflare.com:3478 send -f filename

# Disable STUN entirely — host/mDNS candidates only (LAN use)
gfile --stun="" send -f filename

mDNS

By default gfile advertises host ICE candidates as .local mDNS hostnames instead of raw LAN IPs, matching modern browser behavior. This keeps your internal network topology out of the SDP you paste around, and is enough for a LAN transfer even with --stun="".

Disable it if a peer on the other side cannot resolve mDNS:

gfile --mdns=false send -f filename

Usage

Sender

gfile send --file filename
  • Run the command
  • A compact encoded SDP will appear, send it to the remote client
  • Follow the instructions to send the client's SDP to your process
  • The file transfer should start

Pass --connections N (1..16) to open N parallel peer connections. The default is 1. Higher values can improve throughput on high-latency or high-bandwidth links — see PROTOCOL.md.

Receiver

# SDP being the compact encoded SDP gotten from the other client
echo "$SDP" | gfile receive -o filename
  • Pipe the other client's SDP to gfile
  • A compact encoded SDP will appear, send it to the remote client
  • The file transfer should start

Benchmark

gfile can benchmark the network speed between two clients (one sender, one receiver) with the bench command. The SDP exchange works the same as in send / receive.

This feature is still an experiment.

# Run as 'sender'
gfile bench -s

# Run as 'receiver'
echo "$SDP" |  gfile bench

Debug

For more verbose output, set the logging level via the GFILE_LOG environment variable.

Example: export GFILE_LOG="TRACE" See function setupLogger in main.go for more information

Contributors

Special thanks to Sean DuBois for his help with pion/webrtc and Yutaka Takeda for his work on pion/sctp

Packages

 
 
 

Contributors