MCPcopy Create free account
hub / github.com/M1r0ku/frp-Modify / Run

Method Run

frp-dev/server/proxy/https.go:30–71  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

28}
29
30func (pxy *HTTPSProxy) Run() (remoteAddr string, err error) {
31 xl := pxy.xl
32 routeConfig := &vhost.RouteConfig{}
33
34 defer func() {
35 if err != nil {
36 pxy.Close()
37 }
38 }()
39 addrs := make([]string, 0)
40 for _, domain := range pxy.cfg.CustomDomains {
41 if domain == "" {
42 continue
43 }
44
45 routeConfig.Domain = domain
46 l, errRet := pxy.rc.VhostHTTPSMuxer.Listen(pxy.ctx, routeConfig)
47 if errRet != nil {
48 err = errRet
49 return
50 }
51 xl.Info("https proxy listen for host [%s]", routeConfig.Domain)
52 pxy.listeners = append(pxy.listeners, l)
53 addrs = append(addrs, util.CanonicalAddr(routeConfig.Domain, pxy.serverCfg.VhostHTTPSPort))
54 }
55
56 if pxy.cfg.SubDomain != "" {
57 routeConfig.Domain = pxy.cfg.SubDomain + "." + pxy.serverCfg.SubDomainHost
58 l, errRet := pxy.rc.VhostHTTPSMuxer.Listen(pxy.ctx, routeConfig)
59 if errRet != nil {
60 err = errRet
61 return
62 }
63 xl.Info("https proxy listen for host [%s]", routeConfig.Domain)
64 pxy.listeners = append(pxy.listeners, l)
65 addrs = append(addrs, util.CanonicalAddr(routeConfig.Domain, pxy.serverCfg.VhostHTTPSPort))
66 }
67
68 pxy.startListenHandler(pxy, HandleUserTCPConnection)
69 remoteAddr = strings.Join(addrs, ",")
70 return
71}
72
73func (pxy *HTTPSProxy) GetConf() config.ProxyConf {
74 return pxy.cfg

Callers

nothing calls this directly

Calls 4

CloseMethod · 0.95
InfoMethod · 0.80
startListenHandlerMethod · 0.80
ListenMethod · 0.45

Tested by

no test coverage detected