mirror of
https://github.com/hanzoai/tasks.git
synced 2026-10-04 02:04:03 +00:00
## What changed?
<!-- Describe what has changed in this PR -->
Remove license header from every file. Because it is really hard to
follow in this PR here is the summary:
1. License header is removed from all `.go` and `.proto` files
:fireworks::fireworks:🎆.
2. `LICENSE` file in the root directory has only Temporal and Uber
copyrights.
3. 5 other `LICENSE` files added to the packages which have copyrights
different from Temporal and Uber: Datadog, Xargin, "Mat Ryer, Tyler
Bunnell and contributors".
4. `license_file` flag is removed from all code generation tools.
5. `copyright_file` flag is removed from `go:generate mockgen`
directive.
6. All copyright related targets are removed from `Makefile`.
7. Updated Temporal copyright year to 2025 everywhere.
## Why?
<!-- Tell your future self why have you made these changes -->
I double checked with legal department that it is not needed to have
license header in every file. One file per repo is enough. I put all
copyrights to the root `LICENSE` file and removed header from all other
files. Also updated tools and `Makefile`.
78 lines
1.9 KiB
Go
78 lines
1.9 KiB
Go
package nettest
|
|
|
|
import (
|
|
"context"
|
|
"net"
|
|
|
|
"go.temporal.io/server/common"
|
|
"google.golang.org/grpc"
|
|
"google.golang.org/grpc/credentials/insecure"
|
|
)
|
|
|
|
// RPCFactory is a common.RPCFactory implementation that uses a PipeListener to create connections. It is useful for
|
|
// testing gRPC servers.
|
|
type RPCFactory struct {
|
|
listener *PipeListener
|
|
dialOptions []grpc.DialOption
|
|
}
|
|
|
|
var _ common.RPCFactory = (*RPCFactory)(nil)
|
|
|
|
// NewRPCFactory creates a new RPCFactory backed by a PipeListener.
|
|
func NewRPCFactory(listener *PipeListener, dialOptions ...grpc.DialOption) *RPCFactory {
|
|
return &RPCFactory{
|
|
listener: listener,
|
|
dialOptions: dialOptions,
|
|
}
|
|
}
|
|
|
|
func (f *RPCFactory) GetFrontendGRPCServerOptions() ([]grpc.ServerOption, error) {
|
|
return nil, nil
|
|
}
|
|
|
|
func (f *RPCFactory) GetInternodeGRPCServerOptions() ([]grpc.ServerOption, error) {
|
|
return nil, nil
|
|
}
|
|
|
|
func (f *RPCFactory) GetGRPCListener() net.Listener {
|
|
return f.listener
|
|
}
|
|
|
|
func (f *RPCFactory) CreateRemoteFrontendGRPCConnection(rpcAddress string) *grpc.ClientConn {
|
|
return f.dial(rpcAddress)
|
|
}
|
|
|
|
func (f *RPCFactory) CreateLocalFrontendGRPCConnection() *grpc.ClientConn {
|
|
return f.dial(f.listener.Addr().String())
|
|
}
|
|
|
|
func (f *RPCFactory) CreateLocalFrontendHTTPClient() (*common.FrontendHTTPClient, error) {
|
|
panic("unimplemented in the nettest package")
|
|
}
|
|
|
|
func (f *RPCFactory) CreateHistoryGRPCConnection(rpcAddress string) *grpc.ClientConn {
|
|
return f.dial(rpcAddress)
|
|
}
|
|
|
|
func (f *RPCFactory) CreateMatchingGRPCConnection(rpcAddress string) *grpc.ClientConn {
|
|
return f.dial(rpcAddress)
|
|
}
|
|
|
|
func (f *RPCFactory) dial(rpcAddress string) *grpc.ClientConn {
|
|
dialOptions := append(f.dialOptions,
|
|
grpc.WithContextDialer(func(ctx context.Context, s string) (net.Conn, error) {
|
|
return f.listener.Connect(ctx.Done())
|
|
}),
|
|
grpc.WithTransportCredentials(insecure.NewCredentials()),
|
|
)
|
|
conn, err := grpc.NewClient(
|
|
rpcAddress,
|
|
dialOptions...,
|
|
)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
return conn
|
|
}
|