| 1 | // Copyright 2026 The frp Authors |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | package source |
| 16 | |
| 17 | import ( |
| 18 | v1 "github.com/fatedier/frp/pkg/config/v1" |
| 19 | ) |
| 20 | |
| 21 | // Source is the interface for configuration sources. |
| 22 | // A Source provides proxy and visitor configurations from various backends. |
| 23 | // Aggregator currently uses the built-in config source as base and an optional |
| 24 | // store source as higher-priority overlay. |
| 25 | type Source interface { |
| 26 | // Load loads the proxy and visitor configurations from this source. |
| 27 | // Returns the loaded configurations and any error encountered. |
| 28 | // A disabled entry in one source is source-local filtering, not a cross-source |
| 29 | // tombstone for entries from lower-priority sources. |
| 30 | // |
| 31 | // Error handling contract with Aggregator: |
| 32 | // - When err is nil, returned slices are consumed. |
| 33 | // - When err is non-nil, Aggregator aborts the merge and returns the error. |
| 34 | // - To publish best-effort or partial results, return those results with |
| 35 | // err set to nil. |
| 36 | Load() (proxies []v1.ProxyConfigurer, visitors []v1.VisitorConfigurer, err error) |
| 37 | } |