MCPcopy Index your code
hub / github.com/Antonito/gfile

github.com/Antonito/gfile @v0.2.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.2.0 ↗ · + Follow
445 symbols 1,793 edges 74 files 205 documented · 46% updated 4d agov0.2.0 · 2026-04-20★ 761
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

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

Extension points exported contracts — how you extend this code

FrameHandler (Interface)
FrameHandler is the visitor interface Dispatch calls into. Each method corresponds to exactly one FrameType. [2 implementers]
internal/protocol/handler.go

Core symbols most depended-on inside this repo

Close
called by 43
internal/session/session.go
Dispatch
called by 28
internal/protocol/dispatch.go
fail
called by 25
pkg/transfer/receiver/core.go
New
called by 22
internal/output/emitter.go
Fatal
called by 22
internal/output/emitter.go
EncodeMetadata
called by 15
internal/protocol/frame.go
String
called by 14
pkg/transfer/role.go
New
called by 14
internal/stats/stats.go

Shape

Function 262
Method 142
Struct 31
TypeAlias 5
Class 3
Interface 2

Languages

Go94%
Python6%

Modules by API surface

internal/output/output_test.go25 symbols
internal/session/channel_test.go24 symbols
scripts/bench.py20 symbols
internal/session/channel.go17 symbols
internal/protocol/handler.go17 symbols
pkg/transfer/receiver/multi.go16 symbols
pkg/transfer/sender/multi.go15 symbols
internal/protocol/dispatch_test.go15 symbols
internal/output/emitter.go15 symbols
internal/protocol/frame_test.go14 symbols
pkg/transfer/receiver/single_test.go13 symbols
pkg/transfer/receiver/core_test.go12 symbols

For agents

$ claude mcp add gfile \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact