mirror of
https://github.com/cnsilvan/UnblockNeteaseMusic.git
synced 2025-01-07 03:27:15 +08:00
specify server listen address
This commit is contained in:
parent
bbd409061c
commit
db205716f8
@ -35,6 +35,7 @@ sudo ./UnblockNeteaseMusic
|
||||
```shell
|
||||
./UnblockNeteaseMusic -h
|
||||
|
||||
-a specify server listen address,such as : "0.0.0.0"
|
||||
-b force the best music quality
|
||||
-c string
|
||||
specify server cert,such as : "server.crt" (default "./server.crt")
|
||||
|
@ -8,13 +8,14 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
|
||||
"github.com/cnsilvan/UnblockNeteaseMusic/common"
|
||||
"github.com/cnsilvan/UnblockNeteaseMusic/utils"
|
||||
"github.com/cnsilvan/UnblockNeteaseMusic/version"
|
||||
)
|
||||
|
||||
var (
|
||||
Addr = flag.String("a", "0.0.0.0", "specify server listen address,such as : \"0.0.0.0\"")
|
||||
Port = flag.Int("p", 80, "specify server port,such as : \"80\"")
|
||||
TLSPort = flag.Int("sp", 443, "specify server tls port,such as : \"443\"")
|
||||
Source = flag.String("o", "kuwo", "specify server source,such as : \"kuwo\"")
|
||||
@ -60,7 +61,7 @@ func ValidParams() bool {
|
||||
for _, source := range sources {
|
||||
common.Source = append(common.Source, source)
|
||||
}
|
||||
|
||||
|
||||
currentPath, err := utils.GetCurrentPath()
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
|
@ -3,6 +3,7 @@ package proxy
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"net"
|
||||
@ -26,7 +27,7 @@ var localhost = map[string]int{}
|
||||
|
||||
func InitProxy() {
|
||||
log.Println("-------------------Init Proxy-------------------")
|
||||
address := "0.0.0.0:"
|
||||
// address := "0.0.0.0:"
|
||||
addrs, err := net.InterfaceAddrs()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@ -47,8 +48,8 @@ func InitProxy() {
|
||||
}
|
||||
log.Println("Http Proxy:")
|
||||
log.Println(strings.Join(localhostKey, " , "))
|
||||
go startTlsServer(address+strconv.Itoa(*config.TLSPort), *config.CertFile, *config.KeyFile, &HttpHandler{})
|
||||
go startServer(address+strconv.Itoa(*config.Port), &HttpHandler{})
|
||||
go startTlsServer(fmt.Sprintf("%s:%d", *config.Addr, *config.TLSPort), *config.CertFile, *config.KeyFile, &HttpHandler{})
|
||||
go startServer(fmt.Sprintf("%s:%d", *config.Addr, *config.Port), &HttpHandler{})
|
||||
}
|
||||
func (h *HttpHandler) ServeHTTP(resp http.ResponseWriter, request *http.Request) {
|
||||
defer func() {
|
||||
|
Loading…
Reference in New Issue
Block a user