(r *http.Request, si *cluster.Snode, ts time.Time, netName string)
| 1895 | } |
| 1896 | |
| 1897 | func (p *proxy) redirectURL(r *http.Request, si *cluster.Snode, ts time.Time, netName string) (redirect string) { |
| 1898 | var ( |
| 1899 | nodeURL string |
| 1900 | query = url.Values{} |
| 1901 | ) |
| 1902 | if p.si.LocalNet == nil { |
| 1903 | nodeURL = si.URL(cmn.NetPublic) |
| 1904 | } else { |
| 1905 | var local bool |
| 1906 | remote := r.RemoteAddr |
| 1907 | if colon := strings.Index(remote, ":"); colon != -1 { |
| 1908 | remote = remote[:colon] |
| 1909 | } |
| 1910 | if ip := net.ParseIP(remote); ip != nil { |
| 1911 | local = p.si.LocalNet.Contains(ip) |
| 1912 | } |
| 1913 | if local { |
| 1914 | nodeURL = si.URL(netName) |
| 1915 | } else { |
| 1916 | nodeURL = si.URL(cmn.NetPublic) |
| 1917 | } |
| 1918 | } |
| 1919 | redirect = nodeURL + r.URL.Path + "?" |
| 1920 | if r.URL.RawQuery != "" { |
| 1921 | redirect += r.URL.RawQuery + "&" |
| 1922 | } |
| 1923 | |
| 1924 | query.Set(apc.QparamProxyID, p.si.ID()) |
| 1925 | query.Set(apc.QparamUnixTime, cos.UnixNano2S(ts.UnixNano())) |
| 1926 | redirect += query.Encode() |
| 1927 | return |
| 1928 | } |
| 1929 | |
| 1930 | func initAsyncQuery(bck *cmn.Bck, msg *apc.BckSummMsg, newTaskID string) (bool, url.Values) { |
| 1931 | isNew := msg.UUID == "" |
no test coverage detected