(direction string, verbose bool)
| 227 | } |
| 228 | |
| 229 | func newTSNet(direction string, verbose bool) (*tsnet.Server, error) { |
| 230 | var err error |
| 231 | tmp := os.TempDir() |
| 232 | srv := new(tsnet.Server) |
| 233 | srv.Dir = tmp |
| 234 | srv.Hostname = "wush-" + direction |
| 235 | srv.Ephemeral = true |
| 236 | srv.AuthKey = direction |
| 237 | srv.ControlURL = "http://127.0.0.1:8080" |
| 238 | srv.Logf = func(format string, args ...any) {} |
| 239 | srv.UserLogf = func(format string, args ...any) {} |
| 240 | if verbose { |
| 241 | logf := func(format string, args ...any) { |
| 242 | fmt.Fprintf(os.Stderr, format+"\n", args...) |
| 243 | } |
| 244 | srv.Logf = logf |
| 245 | srv.UserLogf = logf |
| 246 | } |
| 247 | |
| 248 | srv.Store, err = store.New(func(format string, args ...any) {}, "mem:wush") |
| 249 | if err != nil { |
| 250 | return nil, xerrors.Errorf("create state store: %w", err) |
| 251 | } |
| 252 | |
| 253 | return srv, nil |
| 254 | } |
| 255 | |
| 256 | func bicopy(ctx context.Context, c1, c2 io.ReadWriteCloser) { |
| 257 | ctx, cancel := context.WithCancel(ctx) |
no outgoing calls
no test coverage detected