Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QUIC Working but TCP Not Working: connect to server error: session shutdown #3994

Closed
2 of 11 tasks
clarkmcc opened this issue Feb 15, 2024 · 1 comment
Closed
2 of 11 tasks

Comments

@clarkmcc
Copy link

Bug Description

I'm trying to use frp as a library and have been using it for several years in production, however I've just recently upgraded from 0.3x to 0.54.0 and can't seem to get TCP working again. I get the following errors

2024/02/15 10:57:38 [I] [service.go:287] try to connect to server...
2024/02/15 10:57:38 [W] [service.go:290] connect to server error: session shutdown

If I change the client to connect via quic, then it works just fine. This error appears to be coming from yamux. Is there some configuration that I'm missing?

frpc Version

v0.54.0

frps Version

v0.54.0

System Architecture

darwin/arm64

Configurations

Server

package main

import (
	"context"
	v1 "github.com/fatedier/frp/pkg/config/v1"
	"github.com/fatedier/frp/server"
)

func main() {
	svc, err := server.NewService(&v1.ServerConfig{
		APIMetadata: v1.APIMetadata{
			Version: "1",
		},
		Auth: v1.AuthServerConfig{
			Method: "token",
			Token:  "abc",
		},
		BindAddr:      "0.0.0.0",
		BindPort:      7010,
		VhostHTTPPort: 7011,
		QUICBindPort:  7012,
	})
	if err != nil {
		panic(err)
	}

	svc.Run(context.Background())
}

Client

package main

import (
	"context"
	"github.com/fatedier/frp/client"
	v1 "github.com/fatedier/frp/pkg/config/v1"
)

func main() {
	svc, err := client.NewService(client.ServiceOptions{
		Common: &v1.ClientCommonConfig{
			APIMetadata: v1.APIMetadata{
				Version: "1",
			},
			Auth: v1.AuthClientConfig{
				Method: "token",
				Token:  "abc",
			},
			ServerAddr: "127.0.0.1",
			ServerPort: 7010,
			Transport: v1.ClientTransportConfig{
				Protocol: "tcp",
			},
		},
		ProxyCfgs:        []v1.ProxyConfigurer{},
		VisitorCfgs:      nil,
		ConfigFilePath:   "",
		ClientSpec:       nil,
		ConnectorCreator: nil,
		HandleWorkConnCb: nil,
	})
	if err != nil {
		panic(err)
	}

	err = svc.Run(context.Background())
	if err != nil {
		panic(err)
	}
}

Logs

2024/02/15 10:57:38 [I] [service.go:287] try to connect to server...
2024/02/15 10:57:38 [W] [service.go:290] connect to server error: session shutdown

Steps to reproduce

No response

Affected area

  • Docs
  • Installation
  • Performance and Scalability
  • Security
  • User Experience
  • Test and Release
  • Developer Infrastructure
  • Client Plugin
  • Server Plugin
  • Extensions
  • Others
@clarkmcc
Copy link
Author

Apparently I needed to call .Complete() on my cfg before using it.

cfg := &v1.ClientCommonConfig{
	ServerAddr: "127.0.0.1",
	ServerPort: 7010,
	Transport: v1.ClientTransportConfig{
		Protocol: "tcp",
	},
}
cfg.Complete()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant