1 /* 2 * Copyright 2016 The gRPC Authors 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package io.grpc; 18 19 import java.lang.annotation.Documented; 20 import java.lang.annotation.Retention; 21 import java.lang.annotation.RetentionPolicy; 22 import java.net.SocketAddress; 23 import javax.net.ssl.SSLSession; 24 25 /** 26 * Stuff that are part of the public API but are not bound to particular classes, e.g., static 27 * methods, constants, attribute and context keys. 28 */ 29 public final class Grpc { Grpc()30 private Grpc() { 31 } 32 33 /** 34 * Attribute key for the remote address of a transport. 35 */ 36 @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1710") 37 @TransportAttr 38 public static final Attributes.Key<SocketAddress> TRANSPORT_ATTR_REMOTE_ADDR = 39 Attributes.Key.create("remote-addr"); 40 41 /** 42 * Attribute key for the local address of a transport. 43 */ 44 @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1710") 45 @TransportAttr 46 public static final Attributes.Key<SocketAddress> TRANSPORT_ATTR_LOCAL_ADDR = 47 Attributes.Key.create("local-addr"); 48 49 /** 50 * Attribute key for SSL session of a transport. 51 */ 52 @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1710") 53 @TransportAttr 54 public static final Attributes.Key<SSLSession> TRANSPORT_ATTR_SSL_SESSION = 55 Attributes.Key.create("ssl-session"); 56 57 /** 58 * Annotation for transport attributes. It follows the annotation semantics defined 59 * by {@link Attributes}. 60 */ 61 @ExperimentalApi("https://github.com/grpc/grpc-java/issues/4972") 62 @Retention(RetentionPolicy.SOURCE) 63 @Documented 64 public @interface TransportAttr {} 65 } 66