MCPcopy Index your code
hub / github.com/ProtonMail/gluon

github.com/ProtonMail/gluon @v0.17.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.17.0 ↗ · + Follow
3,543 symbols 14,333 edges 473 files 384 documented · 11% 7 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Gluon

An IMAP4rev1 library focusing on correctness, stability and performance.

CI Status GoDoc Go Report Card License

Demo

The demo server can be started with:

$ GLUON_LOG_LEVEL=trace go run demo/demo.go
DEBU[0000] Applying update                               update="MailboxCreated: Mailbox.ID = 0, Mailbox.Name = INBOX" user-id=ac8970c5-cdb7-4043-ad85-ad9b9defcfb8
DEBU[0000] Applying update                               update="MessagesCreated: MessageCount=0 Messages=[]" user-id=ac8970c5-cdb7-4043-ad85-ad9b9defcfb8
INFO[0000] User added to server                          userID=ac8970c5-cdb7-4043-ad85-ad9b9defcfb8
DEBU[0000] Applying update                               update="MailboxCreated: Mailbox.ID = 0, Mailbox.Name = INBOX" user-id=a51fad46-9bde-462a-a467-6c30f9a40a63
DEBU[0000] Applying update                               update="MessagesCreated: MessageCount=0 Messages=[]" user-id=a51fad46-9bde-462a-a467-6c30f9a40a63
INFO[0000] User added to server                          userID=a51fad46-9bde-462a-a467-6c30f9a40a63
INFO[0000] Server is listening on 127.0.0.1:1143

By default, the demo server includes two demo users, both with password pass. The first has addresses user1@example.com and alias1@example.com. The second has addresses user2@example.com and alias2@example.com.

Once started, connect to the demo server with an email client (e.g. thunderbird) or via telnet:

$ telnet 127.0.0.1 1143
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
* OK [CAPABILITY IDLE IMAP4rev1 MOVE UIDPLUS UNSELECT]  00.00.00 - gluon session ID 2
tag login user1@example.com pass
tag OK [CAPABILITY IDLE IMAP4rev1 MOVE UIDPLUS UNSELECT] Logged in
tag append inbox (\Seen) {14}
+ Ready
To: user@pm.me
tag OK [APPENDUID 1 1] APPEND
tag select inbox
* FLAGS (\Answered \Deleted \Flagged \Seen)
* 1 EXISTS
* 1 RECENT
* OK [PERMANENTFLAGS (\Answered \Deleted \Flagged \Seen)] Flags permitted
* OK [UIDNEXT 2] Predicted next UID
* OK [UIDVALIDITY 1] UIDs valid
tag OK [READ-WRITE] SELECT
tag fetch 1:* (UID BODY.PEEK[])
* 1 FETCH (UID 1 BODY[] {32}
X-Pm-Gluon-Id: 1
To: user@pm.me)
tag OK command completed in 1.030958ms

Changing DB schema

Do not forget to re-generate ent code after changing the DB schema in ./internal/db/ent/schema.

``` pushd ./internal/db/ent && go generate . && popd

Extension points exported contracts — how you extend this code

IMAPBenchmark (Interface)
IMAPBenchmark is intended to be used to build benchmarks which bench IMAP commands on a given server. [19 implementers]
benchmarks/gluon_bench/imap_benchmarks/imap_benchmark.go
FetchAttribute (Interface)
(no doc) [169 implementers]
imap/command/fetch.go
CmdProfiler (Interface)
CmdProfiler is the interface that can be used to perform measurements related to the execution scope of incoming IMAP co [4 …
profiling/cmd_profiler.go
Migration (Interface)
(no doc) [21 implementers]
internal/db_impl/sqlite3/migrations.go
Response (Interface)
(no doc) [16 implementers]
internal/response/types.go
Reporter (Interface)
Reporter represents an external reporting tool which can be hooked into gluon to report key information and/or unexpecte [4 …
reporter/reporter.go
Store (Interface)
(no doc) [4 implementers]
store/store.go
Fallback (Interface)
Fallback provides an interface to supply an alternative way to read a store file should the main route fail. This is mai [2 …
store/fallback.go

Core symbols most depended-on inside this repo

NewFlagSet
called by 130
imap/flags.go
Consume
called by 105
rfcparser/parser.go
WithCount
called by 90
internal/response/exists.go
Lock
called by 84
store/semaphore.go
Unlock
called by 84
store/semaphore.go
Select
called by 80
internal/state/state.go
Error
called by 76
rfcparser/parser.go
WithItems
called by 74
internal/response/ok.go

Shape

Method 1,664
Function 1,318
Struct 473
Interface 66
TypeAlias 22

Languages

Go100%

Modules by API surface

imap/command/search_keys.go111 symbols
tests/helper_test.go100 symbols
internal/db_impl/sqlite3/utils/tracer.go66 symbols
internal/state/mailbox_search.go58 symbols
tests/session_test.go55 symbols
tests/server_test.go52 symbols
option.go50 symbols
tests/search_test.go48 symbols
rfcparser/parser.go48 symbols
internal/state/state.go47 symbols
imap/command/search_test.go46 symbols
db/ops_mailbox.go44 symbols

For agents

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

⬇ download graph artifact