Skip to content

Commit

Permalink
[bot] AutoMerging: merge all upstream's changes:
Browse files Browse the repository at this point in the history
* https://github.com/fatedier/frp:
  frpc: support metadatas and annotations in frpc proxy commands (fatedier#4623)
  Fix typos (fatedier#4615)
  client, pkg, server, test: replaced 'interface{}' with 'any' (fatedier#4611)
  Update stale workflow (fatedier#4600)
  • Loading branch information
github-actions[bot] committed Jan 7, 2025
2 parents bc73c75 + 27db621 commit 46d560e
Show file tree
Hide file tree
Showing 24 changed files with 87 additions and 87 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ jobs:
steps:
- uses: actions/stale@v9
with:
stale-issue-message: 'Issues go stale after 21d of inactivity. Stale issues rot after an additional 7d of inactivity and eventually close.'
stale-pr-message: "PRs go stale after 21d of inactivity. Stale PRs rot after an additional 7d of inactivity and eventually close."
stale-issue-message: 'Issues go stale after 14d of inactivity. Stale issues rot after an additional 3d of inactivity and eventually close.'
stale-pr-message: "PRs go stale after 14d of inactivity. Stale PRs rot after an additional 3d of inactivity and eventually close."
stale-issue-label: 'lifecycle/stale'
exempt-issue-labels: 'bug,doc,enhancement,future,proposal,question,testing,todo,easy,help wanted,assigned'
stale-pr-label: 'lifecycle/stale'
exempt-pr-labels: 'bug,doc,enhancement,future,proposal,question,testing,todo,easy,help wanted,assigned'
days-before-stale: 21
days-before-close: 7
days-before-stale: 14
days-before-close: 3
debug-only: ${{ github.event.inputs.debug-only }}
exempt-all-pr-milestones: true
exempt-all-pr-assignees: true
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ frp also offers a P2P connect mode.
* [Client Plugins](#client-plugins)
* [Server Manage Plugins](#server-manage-plugins)
* [SSH Tunnel Gateway](#ssh-tunnel-gateway)
* [Releated Projects](#releated-projects)
* [Related Projects](#related-projects)
* [Contributing](#contributing)
* [Donation](#donation)
* [GitHub Sponsors](#github-sponsors)
Expand Down Expand Up @@ -1260,7 +1260,7 @@ frpc tcp --proxy_name "test-tcp" --local_ip 127.0.0.1 --local_port 8080 --remote

Please refer to this [document](/doc/ssh_tunnel_gateway.md) for more information.

## Releated Projects
## Related Projects

* [gofrp/plugin](https://github.com/gofrp/plugin) - A repository for frp plugins that contains a variety of plugins implemented based on the frp extension mechanism, meeting the customization needs of different scenarios.
* [gofrp/tiny-frpc](https://github.com/gofrp/tiny-frpc) - A lightweight version of the frp client (around 3.5MB at minimum) implemented using the ssh protocol, supporting some of the most commonly used features, suitable for devices with limited resources.
Expand Down
4 changes: 1 addition & 3 deletions Release.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
### Features

* `tzdata` is installed by default in the container image, and the time zone can be set using the `TZ` environment variable.
* The `quic-bind-port` command line parameter is supported in frps, which specifies the port for accepting frpc connections using the QUIC protocol.
* The vhost HTTP proxy of frps supports the h2c protocol.
* Support metadatas and annotations in frpc proxy commands.
2 changes: 1 addition & 1 deletion client/event/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

var ErrPayloadType = errors.New("error payload type")

type Handler func(payload interface{}) error
type Handler func(payload any) error

type StartProxyPayload struct {
NewProxyMsg *msg.NewProxy
Expand Down
2 changes: 1 addition & 1 deletion client/proxy/proxy_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (pm *Manager) HandleWorkConn(name string, workConn net.Conn, m *msg.StartWo
}
}

func (pm *Manager) HandleEvent(payload interface{}) error {
func (pm *Manager) HandleEvent(payload any) error {
var m msg.Message
switch e := payload.(type) {
case *event.StartProxyPayload:
Expand Down
2 changes: 2 additions & 0 deletions pkg/config/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ func registerProxyBaseConfigFlags(cmd *cobra.Command, c *v1.ProxyBaseConfig, opt
}

cmd.Flags().StringVarP(&c.Name, "proxy_name", "n", "", "proxy name")
cmd.Flags().StringToStringVarP(&c.Metadatas, "metadatas", "", nil, "metadata key-value pairs (e.g., key1=value1,key2=value2)")
cmd.Flags().StringToStringVarP(&c.Annotations, "annotations", "", nil, "annotation key-value pairs (e.g., key1=value1,key2=value2)")

if !options.sshMode {
cmd.Flags().StringVarP(&c.LocalIP, "local_ip", "i", "127.0.0.1", "local ip")
Expand Down
4 changes: 2 additions & 2 deletions pkg/config/legacy/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ type ClientCommonConf struct {
}

// Supported sources including: string(file path), []byte, Reader interface.
func UnmarshalClientConfFromIni(source interface{}) (ClientCommonConf, error) {
func UnmarshalClientConfFromIni(source any) (ClientCommonConf, error) {
f, err := ini.LoadSources(ini.LoadOptions{
Insensitive: false,
InsensitiveSections: false,
Expand Down Expand Up @@ -203,7 +203,7 @@ func UnmarshalClientConfFromIni(source interface{}) (ClientCommonConf, error) {
// otherwise just start proxies in startProxy map
func LoadAllProxyConfsFromIni(
prefix string,
source interface{},
source any,
start []string,
) (map[string]ProxyConf, map[string]VisitorConf, error) {
f, err := ini.LoadSources(ini.LoadOptions{
Expand Down
2 changes: 1 addition & 1 deletion pkg/config/legacy/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func GetDefaultServerConf() ServerCommonConf {
}
}

func UnmarshalServerConfFromIni(source interface{}) (ServerCommonConf, error) {
func UnmarshalServerConfFromIni(source any) (ServerCommonConf, error) {
f, err := ini.LoadSources(ini.LoadOptions{
Insensitive: false,
InsensitiveSections: false,
Expand Down
2 changes: 1 addition & 1 deletion pkg/config/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func LoadConfigure(b []byte, c any, strict bool) error {
defer v1.DisallowUnknownFieldsMu.Unlock()
v1.DisallowUnknownFields = strict

var tomlObj interface{}
var tomlObj any
// Try to unmarshal as TOML first; swallow errors from that (assume it's not valid TOML).
if err := toml.Unmarshal(b, &tomlObj); err == nil {
b, err = json.Marshal(&tomlObj)
Expand Down
2 changes: 1 addition & 1 deletion pkg/msg/ctl.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ func ReadMsgInto(c io.Reader, msg Message) (err error) {
return msgCtl.ReadMsgInto(c, msg)
}

func WriteMsg(c io.Writer, msg interface{}) (err error) {
func WriteMsg(c io.Writer, msg any) (err error) {
return msgCtl.WriteMsg(c, msg)
}
2 changes: 1 addition & 1 deletion pkg/msg/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const (
TypeNatHoleReport = '6'
)

var msgTypeMap = map[byte]interface{}{
var msgTypeMap = map[byte]any{
TypeLogin: Login{},
TypeLoginResp: LoginResp{},
TypeNewProxy: NewProxy{},
Expand Down
2 changes: 1 addition & 1 deletion pkg/plugin/server/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (p *httpPlugin) IsSupport(op string) bool {
return false
}

func (p *httpPlugin) Handle(ctx context.Context, op string, content interface{}) (*Response, interface{}, error) {
func (p *httpPlugin) Handle(ctx context.Context, op string, content any) (*Response, any, error) {
r := &Request{
Version: APIVersion,
Op: op,
Expand Down
10 changes: 5 additions & 5 deletions pkg/plugin/server/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (m *Manager) Login(content *LoginContent) (*LoginContent, error) {
Reject: false,
Unchange: true,
}
retContent interface{}
retContent any
err error
)
reqid, _ := util.RandID()
Expand Down Expand Up @@ -109,7 +109,7 @@ func (m *Manager) NewProxy(content *NewProxyContent) (*NewProxyContent, error) {
Reject: false,
Unchange: true,
}
retContent interface{}
retContent any
err error
)
reqid, _ := util.RandID()
Expand Down Expand Up @@ -168,7 +168,7 @@ func (m *Manager) Ping(content *PingContent) (*PingContent, error) {
Reject: false,
Unchange: true,
}
retContent interface{}
retContent any
err error
)
reqid, _ := util.RandID()
Expand Down Expand Up @@ -202,7 +202,7 @@ func (m *Manager) NewWorkConn(content *NewWorkConnContent) (*NewWorkConnContent,
Reject: false,
Unchange: true,
}
retContent interface{}
retContent any
err error
)
reqid, _ := util.RandID()
Expand Down Expand Up @@ -236,7 +236,7 @@ func (m *Manager) NewUserConn(content *NewUserConnContent) (*NewUserConnContent,
Reject: false,
Unchange: true,
}
retContent interface{}
retContent any
err error
)
reqid, _ := util.RandID()
Expand Down
2 changes: 1 addition & 1 deletion pkg/plugin/server/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ const (
type Plugin interface {
Name() string
IsSupport(op string) bool
Handle(ctx context.Context, op string, content interface{}) (res *Response, retContent interface{}, err error)
Handle(ctx context.Context, op string, content any) (res *Response, retContent any, err error)
}
14 changes: 7 additions & 7 deletions pkg/plugin/server/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ import (
)

type Request struct {
Version string `json:"version"`
Op string `json:"op"`
Content interface{} `json:"content"`
Version string `json:"version"`
Op string `json:"op"`
Content any `json:"content"`
}

type Response struct {
Reject bool `json:"reject"`
RejectReason string `json:"reject_reason"`
Unchange bool `json:"unchange"`
Content interface{} `json:"content"`
Reject bool `json:"reject"`
RejectReason string `json:"reject_reason"`
Unchange bool `json:"unchange"`
Content any `json:"content"`
}

type LoginContent struct {
Expand Down
12 changes: 6 additions & 6 deletions pkg/util/log/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,27 +67,27 @@ func InitLogger(logPath string, levelStr string, maxDays int, disableLogColor bo
Logger = Logger.WithOptions(options...)
}

func Errorf(format string, v ...interface{}) {
func Errorf(format string, v ...any) {
Logger.Errorf(format, v...)
}

func Warnf(format string, v ...interface{}) {
func Warnf(format string, v ...any) {
Logger.Warnf(format, v...)
}

func Infof(format string, v ...interface{}) {
func Infof(format string, v ...any) {
Logger.Infof(format, v...)
}

func Debugf(format string, v ...interface{}) {
func Debugf(format string, v ...any) {
Logger.Debugf(format, v...)
}

func Tracef(format string, v ...interface{}) {
func Tracef(format string, v ...any) {
Logger.Tracef(format, v...)
}

func Logf(level log.Level, offset int, format string, v ...interface{}) {
func Logf(level log.Level, offset int, format string, v ...any) {
Logger.Logf(level, offset, format, v...)
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/util/vhost/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type Router struct {
httpUser string

// store any object here
payload interface{}
payload any
}

func NewRouters() *Routers {
Expand All @@ -33,7 +33,7 @@ func NewRouters() *Routers {
}
}

func (r *Routers) Add(domain, location, httpUser string, payload interface{}) error {
func (r *Routers) Add(domain, location, httpUser string, payload any) error {
domain = strings.ToLower(domain)

r.mutex.Lock()
Expand Down
10 changes: 5 additions & 5 deletions pkg/util/xlog/xlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,22 +94,22 @@ func (l *Logger) Spawn() *Logger {
return nl
}

func (l *Logger) Errorf(format string, v ...interface{}) {
func (l *Logger) Errorf(format string, v ...any) {
log.Logger.Errorf(l.prefixString+format, v...)
}

func (l *Logger) Warnf(format string, v ...interface{}) {
func (l *Logger) Warnf(format string, v ...any) {
log.Logger.Warnf(l.prefixString+format, v...)
}

func (l *Logger) Infof(format string, v ...interface{}) {
func (l *Logger) Infof(format string, v ...any) {
log.Logger.Infof(l.prefixString+format, v...)
}

func (l *Logger) Debugf(format string, v ...interface{}) {
func (l *Logger) Debugf(format string, v ...any) {
log.Logger.Debugf(l.prefixString+format, v...)
}

func (l *Logger) Tracef(format string, v ...interface{}) {
func (l *Logger) Tracef(format string, v ...any) {
log.Logger.Tracef(l.prefixString+format, v...)
}
34 changes: 17 additions & 17 deletions server/dashboard_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,15 +196,15 @@ func getConfByType(proxyType string) any {

// Get proxy info.
type ProxyStatsInfo struct {
Name string `json:"name"`
Conf interface{} `json:"conf"`
ClientVersion string `json:"clientVersion,omitempty"`
TodayTrafficIn int64 `json:"todayTrafficIn"`
TodayTrafficOut int64 `json:"todayTrafficOut"`
CurConns int64 `json:"curConns"`
LastStartTime string `json:"lastStartTime"`
LastCloseTime string `json:"lastCloseTime"`
Status string `json:"status"`
Name string `json:"name"`
Conf any `json:"conf"`
ClientVersion string `json:"clientVersion,omitempty"`
TodayTrafficIn int64 `json:"todayTrafficIn"`
TodayTrafficOut int64 `json:"todayTrafficOut"`
CurConns int64 `json:"curConns"`
LastStartTime string `json:"lastStartTime"`
LastCloseTime string `json:"lastCloseTime"`
Status string `json:"status"`
}

type GetProxyInfoResp struct {
Expand Down Expand Up @@ -272,14 +272,14 @@ func (svr *Service) getProxyStatsByType(proxyType string) (proxyInfos []*ProxySt

// Get proxy info by name.
type GetProxyStatsResp struct {
Name string `json:"name"`
Conf interface{} `json:"conf"`
TodayTrafficIn int64 `json:"todayTrafficIn"`
TodayTrafficOut int64 `json:"todayTrafficOut"`
CurConns int64 `json:"curConns"`
LastStartTime string `json:"lastStartTime"`
LastCloseTime string `json:"lastCloseTime"`
Status string `json:"status"`
Name string `json:"name"`
Conf any `json:"conf"`
TodayTrafficIn int64 `json:"todayTrafficIn"`
TodayTrafficOut int64 `json:"todayTrafficOut"`
CurConns int64 `json:"curConns"`
LastStartTime string `json:"lastStartTime"`
LastCloseTime string `json:"lastCloseTime"`
Status string `json:"status"`
}

// /api/proxy/:type/:name
Expand Down
Loading

0 comments on commit 46d560e

Please sign in to comment.