mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-18 04:10:51 +08:00
feat(auth, docs): add SDK guides and local password support for management
- Added extensive SDK usage guides for `cliproxy`, `sdk/access`, and watcher integration. - Introduced `--password` flag for specifying local management access passwords. - Enhanced management API with local password checks to secure localhost requests. - Updated documentation to reflect the new password functionality.
This commit is contained in:
@@ -142,6 +142,15 @@ func (b *Builder) WithServerOptions(opts ...api.ServerOption) *Builder {
|
||||
return b
|
||||
}
|
||||
|
||||
// WithLocalManagementPassword configures a password that is only accepted from localhost management requests.
|
||||
func (b *Builder) WithLocalManagementPassword(password string) *Builder {
|
||||
if password == "" {
|
||||
return b
|
||||
}
|
||||
b.serverOptions = append(b.serverOptions, api.WithLocalManagementPassword(password))
|
||||
return b
|
||||
}
|
||||
|
||||
// Build validates inputs, applies defaults, and returns a ready-to-run service.
|
||||
func (b *Builder) Build() (*Service, error) {
|
||||
if b.cfg == nil {
|
||||
|
||||
Reference in New Issue
Block a user