浏览文件
applied.go
21 行 · 679 B历史下载| 1 | package managedproxy |
| 2 | |
| 3 | import "errors" |
| 4 | |
| 5 | // Applied is the single source of truth for the private endpoint used by Cage. |
| 6 | func Applied(profile, endpoint, revision string) (Store, error) { |
| 7 | p, err := Load(profile) |
| 8 | if err != nil { |
| 9 | return p, err |
| 10 | } |
| 11 | if _, ok := p.Find(p.Selected); !ok { |
| 12 | return p, errors.New("尚未选择代理节点,请在网络与代理中添加来源并选择节点") |
| 13 | } |
| 14 | if revision == "" || p.Revision == "" || revision != p.Revision || endpoint != p.Endpoint() { |
| 15 | return p, errors.New("代理节点尚未应用或配置不一致,请重新应用节点;外网保持关闭") |
| 16 | } |
| 17 | if _, err := p.Route(); err != nil { |
| 18 | return p, err |
| 19 | } |
| 20 | return p, nil |
| 21 | } |

