1.2 KiB
1.2 KiB
Code Mode Rules for Telemt
Error Handling
- Always use
ProxyErrorfromsrc/error.rsfor proxy operations HandshakeResult<T,R,W>returns streams on bad client - these MUST be returned for masking, never dropped- Use
Recoverabletrait to check if errors are retryable
Configuration Changes
ProxyConfig::load()auto-mutates config - new fields should have defaults- DC203 override is auto-injected if missing - do not remove this behavior
- When adding config fields, add migration logic in
ProxyConfig::load()
Crypto Code
SecureRandomfromsrc/crypto/random.rsmust be used for all crypto operations- Never use
rand::thread_rng()directly - use the sharedArc<SecureRandom>
Stream Handling
- Buffer pool
BufferPoolis shared via Arc - always use it instead of allocating - Frame codecs in
src/stream/frame_codec.rsimplement tokio-util's Encoder/Decoder traits
Testing
- Tests are inline in modules using
#[cfg(test)] - Use
cargo test --lib <module_name>to run tests for specific modules