proxyEndpoint.go 889 B

1234567891011121314151617181920212223242526272829303132
  1. package dynamicproxy
  2. /*
  3. ProxyEndpoint.go
  4. author: tobychui
  5. This script handle the proxy endpoint object actions
  6. so proxyEndpoint can be handled like a proper oop object
  7. Most of the functions are implemented in dynamicproxy.go
  8. */
  9. // Update change in the current running proxy endpoint config
  10. func (ep *ProxyEndpoint) UpdateToRuntime() {
  11. ep.parent.ProxyEndpoints.Store(ep.RootOrMatchingDomain, ep)
  12. }
  13. // Remove this proxy endpoint from running proxy endpoint list
  14. func (ep *ProxyEndpoint) Remove() error {
  15. ep.parent.ProxyEndpoints.Delete(ep.RootOrMatchingDomain)
  16. return nil
  17. }
  18. // ProxyEndpoint remove provide global access by key
  19. func (router *Router) RemoveProxyEndpointByRootname(rootnameOrMatchingDomain string) error {
  20. targetEpt, err := router.LoadProxy(rootnameOrMatchingDomain)
  21. if err != nil {
  22. return err
  23. }
  24. return targetEpt.Remove()
  25. }