mirror of
https://github.com/fluffos/fluffos
synced 2026-08-12 18:26:06 -04:00
* docs: fully-expandable generated sidebar, replacing index.md link pages
Rework docs navigation so the sidebar expands to every page of every
reference tree, instead of terminating at generated index.md link lists:
- New docs/gen_sidebar.py (replaces gen_index.py + update_index.sh):
walks efun/, apply/, stdlib/, concepts/, driver/, cli/ and zh-CN/ and
emits sidebars.generated.json — a full Docusaurus category tree per
directory. Category landing pages are now `generated-index` card pages
(title/description/slug), so all generated index.md files are deleted.
--check mode verifies freshness; new .github/workflows/docs-sidebar.yml
runs it in CI.
- New docs/sidebar_meta.json holds curated presentation: category labels,
one-line descriptions (shown on the landing cards), explicit ordering
(driver/cli/concepts read top-down from user-facing to internals) and
per-page label overrides.
- sidebars.ts becomes a hand-authored skeleton (Getting Started, lpc/,
Historical) that splices in the generated trees.
Content reorganization (from a docs-wide review):
- Move misplaced efun pages out of efun/general: terminal/protocol efuns
(act_mxp, send_zmp, request_term_*) to interactive/, debugging efuns
(check_memory, dump_*, clear_debug_level, destructed_objects) to
internals/, shallow_inherit_list to system/.
- Delete stub duplicates superseded by complete pages elsewhere:
general/parse_{add_synonym,dump,my_rules,remove}, contrib/{shuffle,
element_of}.
Modernize key pages with MDX:
- index.mdx: landing page with a card grid linking each doc section.
- build.mdx: per-platform <Tabs> (Ubuntu/macOS/Windows/Alpine+Docker),
admonitions, VitePress [[toc]] leftover removed, stale per-platform CI
workflow links updated to the unified ci.yml.
- ffi-plan.md: GitHub-style [!CAUTION] alert converted to an admonition.
`npm run build` passes clean (onBrokenLinks: throw, no warnings).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0174GM2azvAHBmvyESwxm5om
* docs: serve the Chinese corpus through Docusaurus i18n
Move the zh-CN/ directory out of the default docs tree and into a proper
Docusaurus locale (i18n/zh-CN/docusaurus-plugin-content-docs/current/):
- The flat zh-CN/efun/ directory (333 pages) is re-homed to mirror the
categorized English layout (name-matched 1:1; `hash` maps to strings/
per its own frontmatter). apply/ pages map 1:1; the stray English-text
zh-CN/apply/master/view_errors.md documents a MudOS-era apply that no
longer exists in the driver and is dropped; stdlib/db/database_zh.md
becomes the i18n translation of stdlib/db/database.md; the Chinese
build guide becomes the translation of build.mdx.
- Untranslated pages automatically fall back to English content under
/zh-CN/, so the whole site is navigable in either locale from the new
navbar locale dropdown.
- Both locales share one sidebar. Generated sidebar items now carry
stable `key` fields (the directory/doc path) so translation keys are
unique (both efun/ and stdlib/ have an "Arrays" category, crypto and
strings both document `hash`). Category labels, generated-index
titles/descriptions, navbar and footer are translated in
i18n/zh-CN/...; theme UI strings come from Docusaurus' bundled
zh-Hans translations. Translated landing page at /zh-CN/.
- The "中文文档" sidebar section, the zh-CN tree in gen_sidebar.py /
sidebar_meta.json, and its slice of sidebars.generated.json are gone.
- Relative .md-file links on pages that render in both locales break
the localized build (the file->permalink map points at the localized
copy), so concepts/, the two socket_*_option pages and the config.md
generator now emit extension-less route links instead.
- zh interactive.md/objects.md get explicit slugs like their English
counterparts (a doc named after its parent directory is otherwise a
Docusaurus category-index doc, colliding with the generated-index
route).
`npm run build` builds both locales clean (onBrokenLinks: throw).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0174GM2azvAHBmvyESwxm5om
---------
Co-authored-by: Claude <noreply@anthropic.com>
3.8 KiB
3.8 KiB
| title |
|---|
| sockets / socket_get_option |
socket_get_option
NAME
socket_get_option - get socket option values
SYNOPSIS
mixed socket_get_option(int socket, int option);
DESCRIPTION
Retrieves the current value of a socket option. This efun allows you to
query socket configuration parameters, particularly those related to
TLS/SSL connections.
ARGUMENTS
socket- The socket descriptor returned by socket_create()option- The option constant to query (see Options below)
OPTIONS
SO_TLS_VERIFY_PEER (1)
Returns whether TLS peer certificate verification is enabled.
- Returns: integer
0- Peer verification disabled1- Peer verification enabled
SO_TLS_SNI_HOSTNAME (2)
Returns the Server Name Indication (SNI) hostname set for the socket.
- Returns: string
- The SNI hostname, or an empty string if not set
RETURN VALUE
The return type depends on the option being queried:
- SO_TLS_VERIFY_PEER returns an integer (0 or 1)
- SO_TLS_SNI_HOSTNAME returns a string
ERRORS
- Generates an error if the socket descriptor is invalid
- Generates an error if the option is unknown
EXAMPLES
Query socket TLS settings:
void check_socket_config(int sock) {
int verify_peer;
string sni_hostname;
verify_peer = socket_get_option(sock, SO_TLS_VERIFY_PEER);
sni_hostname = socket_get_option(sock, SO_TLS_SNI_HOSTNAME);
write(sprintf("Socket %d TLS verification: %s\n",
sock, verify_peer ? "enabled" : "disabled"));
write(sprintf("Socket %d SNI hostname: %s\n",
sock, sni_hostname));
}
Verify socket configuration before connecting:
void safe_connect(string hostname, int port) {
int sock;
sock = socket_create(STREAM_TLS, "read_callback", "close_callback");
socket_set_option(sock, SO_TLS_VERIFY_PEER, 1);
socket_set_option(sock, SO_TLS_SNI_HOSTNAME, hostname);
// Verify settings were applied
if (socket_get_option(sock, SO_TLS_VERIFY_PEER) != 1) {
write("Warning: TLS verification not enabled!\n");
return;
}
if (socket_get_option(sock, SO_TLS_SNI_HOSTNAME) != hostname) {
write("Warning: SNI hostname mismatch!\n");
return;
}
socket_connect(sock, hostname + ":" + port, "connected_callback");
}
Debug socket configuration:
void debug_socket(int sock) {
mapping opts = ([]);
opts["verify_peer"] = socket_get_option(sock, SO_TLS_VERIFY_PEER);
opts["sni_hostname"] = socket_get_option(sock, SO_TLS_SNI_HOSTNAME);
write("Socket configuration:\n" + dump_value(opts));
}
Conditional behavior based on socket settings:
void handle_connection(int sock) {
if (socket_get_option(sock, SO_TLS_VERIFY_PEER) == 0) {
log_message("WARNING: Connecting without certificate verification");
// Maybe add additional validation or logging
}
// Proceed with connection logic
socket_connect(sock, "server.example.com:443", "on_connect");
}
SEE ALSO
- socket_set_option - Set socket options
- socket_create - Create a socket
- socket_status - Get socket status
NOTES
Option Constants: The option constants should be defined in your mudlib include files:
#define SO_TLS_VERIFY_PEER 1
#define SO_TLS_SNI_HOSTNAME 2
Default Values:
- SO_TLS_VERIFY_PEER defaults to
1(verification enabled) for security - SO_TLS_SNI_HOSTNAME defaults to an empty string (not set)
Use Cases:
- Debugging socket configuration
- Validating security settings before connection
- Conditional logic based on socket setup
- Logging and auditing connection parameters
AVAILABILITY
Added in commit 1fd7f61 (2023). Requires the sockets package to be enabled.