OmniaGM commented on code in PR #15772: URL: https://github.com/apache/kafka/pull/15772#discussion_r1573897839
########## server/src/main/java/org/apache/kafka/network/SocketServerConfigs.java: ########## @@ -0,0 +1,146 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.kafka.network; + +import org.apache.kafka.common.network.ListenerName; +import org.apache.kafka.common.security.auth.SecurityProtocol; +import org.apache.kafka.server.config.ReplicationConfigs; +import java.util.Arrays; +import java.util.stream.Collectors; + +public class SocketServerConfigs { + public static final String LISTENER_SECURITY_PROTOCOL_MAP_CONFIG = "listener.security.protocol.map"; + public static final String LISTENER_SECURITY_PROTOCOL_MAP_DEFAULT = Arrays.stream(SecurityProtocol.values()) + .collect(Collectors.toMap(ListenerName::forSecurityProtocol, sp -> sp)) + .entrySet() + .stream() + .map(entry -> entry.getKey().value() + ":" + entry.getValue().name()) + .collect(Collectors.joining(",")); + public static final String LISTENER_SECURITY_PROTOCOL_MAP_DOC = "Map between listener names and security protocols. This must be defined for " + + "the same security protocol to be usable in more than one port or IP. For example, internal and " + + "external traffic can be separated even if SSL is required for both. Concretely, the user could define listeners " + + "with names INTERNAL and EXTERNAL and this property as: <code>INTERNAL:SSL,EXTERNAL:SSL</code>. As shown, key and value are " + + "separated by a colon and map entries are separated by commas. Each listener name should only appear once in the map. " + + "Different security (SSL and SASL) settings can be configured for each listener by adding a normalised " + + "prefix (the listener name is lowercased) to the config name. For example, to set a different keystore for the " + + "INTERNAL listener, a config with name <code>listener.name.internal.ssl.keystore.location</code> would be set. " + + "If the config for the listener name is not set, the config will fallback to the generic config (i.e. <code>ssl.keystore.location</code>). " + + "Note that in KRaft a default mapping from the listener names defined by <code>controller.listener.names</code> to PLAINTEXT " + + "is assumed if no explicit mapping is provided and no other security protocol is in use."; + + public static final String LISTENERS_CONFIG = "listeners"; + public static final String LISTENERS_DEFAULT = "PLAINTEXT://:9092"; + public static final String LISTENERS_DOC = "Listener List - Comma-separated list of URIs we will listen on and the listener names." + + String.format(" If the listener name is not a security protocol, <code>%s</code> must also be set.%n", LISTENER_SECURITY_PROTOCOL_MAP_CONFIG) + + " Listener names and port numbers must be unique unless %n" + + " one listener is an IPv4 address and the other listener is %n" + + " an IPv6 address (for the same port).%n" + + " Specify hostname as 0.0.0.0 to bind to all interfaces.%n" + + " Leave hostname empty to bind to default interface.%n" + + " Examples of legal listener lists:%n" + + " <code>PLAINTEXT://myhost:9092,SSL://:9091</code>%n" + + " <code>CLIENT://0.0.0.0:9092,REPLICATION://localhost:9093</code>%n" + + " <code>PLAINTEXT://127.0.0.1:9092,SSL://[::1]:9092</code>%n"; + + public static final String ADVERTISED_LISTENERS_CONFIG = "advertised.listeners"; + public static final String ADVERTISED_LISTENERS_DOC = String.format( + "Listeners to publish to ZooKeeper for clients to use, if different than the <code>%s</code> config property." + + " In IaaS environments, this may need to be different from the interface to which the broker binds." + + " If this is not set, the value for <code>%1$1s</code> will be used." + + " Unlike <code>%1$1s</code>, it is not valid to advertise the 0.0.0.0 meta-address.%n" + + " Also unlike <code>%1$1s</code>, there can be duplicated ports in this property," + + " so that one listener can be configured to advertise another listener's address." + + " This can be useful in some cases where external load balancers are used.", LISTENERS_CONFIG); + + + public static final String CONTROL_PLANE_LISTENER_NAME_CONFIG = "control.plane.listener.name"; + public static final String CONTROL_PLANE_LISTENER_NAME_DOC = String.format( + "Name of listener used for communication between controller and brokers. " + + "A broker will use the <code>%s</code> to locate the endpoint in $ListenersProp list, to listen for connections from the controller. " + Review Comment: good catch published a fix -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org