tethering.go 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // Package tethering provides the Chrome DevTools Protocol
  2. // commands, types, and events for the Tethering domain.
  3. //
  4. // The Tethering domain defines methods and events for browser port binding.
  5. //
  6. // Generated by the cdproto-gen command.
  7. package tethering
  8. // Code generated by cdproto-gen. DO NOT EDIT.
  9. import (
  10. "context"
  11. "github.com/chromedp/cdproto/cdp"
  12. )
  13. // BindParams request browser port binding.
  14. type BindParams struct {
  15. Port int64 `json:"port"` // Port number to bind.
  16. }
  17. // Bind request browser port binding.
  18. //
  19. // See: https://chromedevtools.github.io/devtools-protocol/tot/Tethering#method-bind
  20. //
  21. // parameters:
  22. //
  23. // port - Port number to bind.
  24. func Bind(port int64) *BindParams {
  25. return &BindParams{
  26. Port: port,
  27. }
  28. }
  29. // Do executes Tethering.bind against the provided context.
  30. func (p *BindParams) Do(ctx context.Context) (err error) {
  31. return cdp.Execute(ctx, CommandBind, p, nil)
  32. }
  33. // UnbindParams request browser port unbinding.
  34. type UnbindParams struct {
  35. Port int64 `json:"port"` // Port number to unbind.
  36. }
  37. // Unbind request browser port unbinding.
  38. //
  39. // See: https://chromedevtools.github.io/devtools-protocol/tot/Tethering#method-unbind
  40. //
  41. // parameters:
  42. //
  43. // port - Port number to unbind.
  44. func Unbind(port int64) *UnbindParams {
  45. return &UnbindParams{
  46. Port: port,
  47. }
  48. }
  49. // Do executes Tethering.unbind against the provided context.
  50. func (p *UnbindParams) Do(ctx context.Context) (err error) {
  51. return cdp.Execute(ctx, CommandUnbind, p, nil)
  52. }
  53. // Command names.
  54. const (
  55. CommandBind = "Tethering.bind"
  56. CommandUnbind = "Tethering.unbind"
  57. )