k8s/io/kubernetes/pkg/api.Protocol 示例代码

2022-03-03

以下示例是关于golang中包含api.Protocol用法的示例代码,想了解api.Protocol的具体用法?api.Protocol怎么用?api.Protocol使用的例子?那么可以参考以下10个相关示例代码来学习它的具体使用方法。

示例1:
proxier.go开发语言: Go项目名称: kubernetes代码行数: 806
38	portalPort int
39	protocol   api.Protocol
40	proxyPort  int
277
278func newProxySocket(protocol api.Protocol, ip net.IP, port int) (proxySocket, error) {
279	host := ip.String()
419// connections, for now.
420func (proxier *Proxier) addServiceOnPort(service string, protocol api.Protocol, proxyPort int, timeout time.Duration) (*serviceInfo, error) {
421	sock, err := newProxySocket(protocol, proxier.listenIP, proxyPort)
546
547func (proxier *Proxier) openOnePortal(portalIP net.IP, portalPort int, protocol api.Protocol, proxyIP net.IP, proxyPort int, name string) error {
548	// Handle traffic from containers.
585
586func (proxier *Proxier) closeOnePortal(portalIP net.IP, portalPort int, protocol api.Protocol, proxyIP net.IP, proxyPort int, name string) []error {
587	el := []error{}
示例2:
proxier.go开发语言: Go项目名称: kubernetes代码行数: 568
36	portalPort int
37	protocol   api.Protocol
38	proxyPort  int
273
274func newProxySocket(protocol api.Protocol, ip net.IP, port int) (proxySocket, error) {
275	host := ip.String()
392// connections, for now.
393func (proxier *Proxier) addServiceOnPort(service string, protocol api.Protocol, proxyPort int, timeout time.Duration) (*serviceInfo, error) {
394	sock, err := newProxySocket(protocol, proxier.listenAddress, proxyPort)
示例3:
proxier.go开发语言: Go项目名称: ddysher代码行数: 1732
141	port                     int
142	protocol                 api.Protocol
143	nodePort                 int
336			glog.V(1).Infof("Removing service port %q", svcPortName)
337			if info.protocol == api.ProtocolUDP {
338				staleServices.Insert(info.clusterIP.String())
968	for epSvcPair := range connectionMap {
969		if svcInfo, ok := proxier.serviceMap[epSvcPair.servicePortName]; ok && svcInfo.protocol == api.ProtocolUDP {
970			endpointIP := epSvcPair.endpoint[0:strings.Index(epSvcPair.endpoint, ":")]
1011	for svcPortName := range endpointUpdateResult.staleServiceNames {
1012		if svcInfo, ok := proxier.serviceMap[svcPortName]; ok && svcInfo != nil && svcInfo.protocol == api.ProtocolUDP {
1013			glog.V(2).Infof("Stale udp service %v -> %s", svcPortName, svcInfo.clusterIP.String())
示例4:
proxier.go开发语言: Go项目名称: ddysher代码行数: 1118
57	portal              portal
58	protocol            api.Protocol
59	proxyPort           int
91// ProxySocketFunc is a function which constructs a ProxySocket from a protocol, ip, and port
92type ProxySocketFunc func(protocol api.Protocol, ip net.IP, port int) (ProxySocket, error)
93
121	port     int
122	protocol api.Protocol
123}
364// connections, for now.
365func (proxier *Proxier) addServiceOnPort(service proxy.ServicePortName, protocol api.Protocol, proxyPort int, timeout time.Duration) (*ServiceInfo, error) {
366	sock, err := proxier.makeProxySocket(protocol, proxier.listenIP, proxyPort)
490
491		if proxier.serviceMap[serviceName].protocol == api.ProtocolUDP {
492			staleUDPServices.Insert(proxier.serviceMap[serviceName].portal.ip.String())
示例5:
proxier.go开发语言: Go项目名称: detiber代码行数: 1704
141	port                     int
142	protocol                 api.Protocol
143	nodePort                 int
325			glog.V(1).Infof("Removing service port %q", svcPortName)
326			if info.protocol == api.ProtocolUDP {
327				staleServices.Insert(info.clusterIP.String())
950	for epSvcPair := range connectionMap {
951		if svcInfo, ok := proxier.serviceMap[epSvcPair.servicePortName]; ok && svcInfo.protocol == api.ProtocolUDP {
952			endpointIP := epSvcPair.endpoint[0:strings.Index(epSvcPair.endpoint, ":")]
示例6:
proxier.go开发语言: Go项目名称: detiber代码行数: 1112
57	portal              portal
58	protocol            api.Protocol
59	proxyPort           int
91// ProxySocketFunc is a function which constructs a ProxySocket from a protocol, ip, and port
92type ProxySocketFunc func(protocol api.Protocol, ip net.IP, port int) (ProxySocket, error)
93
121	port     int
122	protocol api.Protocol
123}
358// connections, for now.
359func (proxier *Proxier) addServiceOnPort(service proxy.ServicePortName, protocol api.Protocol, proxyPort int, timeout time.Duration) (*ServiceInfo, error) {
360	sock, err := proxier.makeProxySocket(protocol, proxier.listenIP, proxyPort)
484
485		if proxier.serviceMap[serviceName].protocol == api.ProtocolUDP {
486			staleUDPServices.Insert(proxier.serviceMap[serviceName].portal.ip.String())
示例7:
proxier.go开发语言: Go项目名称: ddysher代码行数: 486
49	portal              portal
50	protocol            api.Protocol
51	socket              proxySocket
102	port     int
103	protocol api.Protocol
104}
233// The timeout only applies to UDP connections, for now.
234func (proxier *Proxier) addServicePortPortal(servicePortPortalName ServicePortPortalName, protocol api.Protocol, listenIP string, port int, timeout time.Duration) (*serviceInfo, error) {
235	var serviceIP net.IP
450
451func sameConfig(info *serviceInfo, service *api.Service, protocol api.Protocol, listenPort int) bool {
452	return info.protocol == protocol && info.portal.port == listenPort && info.sessionAffinityType == service.Spec.SessionAffinity
示例8:
proxier.go开发语言: Go项目名称: detiber代码行数: 486
49	portal              portal
50	protocol            api.Protocol
51	socket              proxySocket
102	port     int
103	protocol api.Protocol
104}
233// The timeout only applies to UDP connections, for now.
234func (proxier *Proxier) addServicePortPortal(servicePortPortalName ServicePortPortalName, protocol api.Protocol, listenIP string, port int, timeout time.Duration) (*serviceInfo, error) {
235	var serviceIP net.IP
450
451func sameConfig(info *serviceInfo, service *api.Service, protocol api.Protocol, listenPort int) bool {
452	return info.protocol == protocol && info.portal.port == listenPort && info.sessionAffinityType == service.Spec.SessionAffinity
示例9:
fuzzer.go开发语言: Go项目名称: kubernetes代码行数: 246
188		func(p *api.Protocol, c fuzz.Continue) {
189			protocols := []api.Protocol{api.ProtocolTCP, api.ProtocolUDP}
190			*p = protocols[c.Rand.Intn(len(protocols))]
示例10:
service.go开发语言: Go项目名称: kubernetes代码行数: 88
65			Port:     port,
66			Protocol: api.Protocol(params["protocol"]),
67			Selector: selector,

本文地址:https://www.itbaoku.cn/snippets/415624.html