| 868 | } |
| 869 | |
| 870 | func (s *Server) Proxy(c *stdapi.Context) error { |
| 871 | if err := s.hook("ProxyValidate", c); err != nil { |
| 872 | return err |
| 873 | } |
| 874 | |
| 875 | host := c.Var("host") |
| 876 | |
| 877 | port, cerr := strconv.Atoi(c.Var("port")) |
| 878 | if cerr != nil { |
| 879 | return cerr |
| 880 | } |
| 881 | |
| 882 | var opts structs.ProxyOptions |
| 883 | if err := stdapi.UnmarshalOptions(c.Request(), &opts); err != nil { |
| 884 | return err |
| 885 | } |
| 886 | |
| 887 | err := s.provider(c).WithContext(c.Context()).Proxy(host, port, stdsdk.NewAdapterWs(c.Websocket()), opts) |
| 888 | if err != nil { |
| 889 | return err |
| 890 | } |
| 891 | |
| 892 | return nil |
| 893 | } |
| 894 | |
| 895 | func (s *Server) RegistryAdd(c *stdapi.Context) error { |
| 896 | if err := s.hook("RegistryAddValidate", c); err != nil { |