mirror of
https://gitee.com/IrisVega/frp.git
synced 2024-11-01 22:31:29 +08:00
d1f5ec083a
add http proxy add proxy code add proxy
33 lines
528 B
Go
33 lines
528 B
Go
package proxy
|
|
|
|
import (
|
|
"bufio"
|
|
"encoding/json"
|
|
"os"
|
|
)
|
|
|
|
// Config 保存代理服务器的配置
|
|
type Config struct {
|
|
Port string `json:"port"`
|
|
Auth bool `json:"auth"`
|
|
|
|
User map[string]string `json:"user"`
|
|
}
|
|
|
|
// 从指定json文件读取config配置
|
|
func (c *Config) GetConfig(filename string) error {
|
|
|
|
configFile, err := os.Open(filename)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
defer configFile.Close()
|
|
|
|
br := bufio.NewReader(configFile)
|
|
err = json.NewDecoder(br).Decode(c)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|