File: tethering.go

package info (click to toggle)
golang-github-chromedp-cdproto 0.0~git20230109.6b041c6-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 4,584 kB
  • sloc: makefile: 2
file content (67 lines) | stat: -rw-r--r-- 1,582 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// Package tethering provides the Chrome DevTools Protocol
// commands, types, and events for the Tethering domain.
//
// The Tethering domain defines methods and events for browser port binding.
//
// Generated by the cdproto-gen command.
package tethering

// Code generated by cdproto-gen. DO NOT EDIT.

import (
	"context"

	"github.com/chromedp/cdproto/cdp"
)

// BindParams request browser port binding.
type BindParams struct {
	Port int64 `json:"port"` // Port number to bind.
}

// Bind request browser port binding.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Tethering#method-bind
//
// parameters:
//
//	port - Port number to bind.
func Bind(port int64) *BindParams {
	return &BindParams{
		Port: port,
	}
}

// Do executes Tethering.bind against the provided context.
func (p *BindParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandBind, p, nil)
}

// UnbindParams request browser port unbinding.
type UnbindParams struct {
	Port int64 `json:"port"` // Port number to unbind.
}

// Unbind request browser port unbinding.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Tethering#method-unbind
//
// parameters:
//
//	port - Port number to unbind.
func Unbind(port int64) *UnbindParams {
	return &UnbindParams{
		Port: port,
	}
}

// Do executes Tethering.unbind against the provided context.
func (p *UnbindParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandUnbind, p, nil)
}

// Command names.
const (
	CommandBind   = "Tethering.bind"
	CommandUnbind = "Tethering.unbind"
)