coap_refactoring_ransport_yml_03 (#10821)
* coap: refactoring transport (*.yml) * coap: refactoring transport (*.yml) -2 * lwm2m: delete the parameter that is not used * coap: refactoring service as PE * coap: refactoring service as PE * coap: refactoring dtlsSettings as PE * coap: refactoring dtlsSettings as PE * coap: refactoring dtlsSettings as PE-3
This commit is contained in:
		
							parent
							
								
									9b9cd80d96
								
							
						
					
					
						commit
						010224acc8
					
				@ -937,7 +937,7 @@ transport:
 | 
				
			|||||||
  client_side_rpc:
 | 
					  client_side_rpc:
 | 
				
			||||||
    # Processing timeout interval of the RPC command on the CLIENT SIDE. Time in milliseconds
 | 
					    # Processing timeout interval of the RPC command on the CLIENT SIDE. Time in milliseconds
 | 
				
			||||||
    timeout: "${CLIENT_SIDE_RPC_TIMEOUT:60000}"
 | 
					    timeout: "${CLIENT_SIDE_RPC_TIMEOUT:60000}"
 | 
				
			||||||
  # Enable/disable http/mqtt/coap transport protocols (has higher priority than certain protocol's 'enabled' property)
 | 
					  # Enable/disable http/mqtt/coap/lwm2m transport protocols (has higher priority than certain protocol's 'enabled' property)
 | 
				
			||||||
  api_enabled: "${TB_TRANSPORT_API_ENABLED:true}"
 | 
					  api_enabled: "${TB_TRANSPORT_API_ENABLED:true}"
 | 
				
			||||||
  log:
 | 
					  log:
 | 
				
			||||||
    # Enable/Disable log of transport messages to telemetry. For example, logging of LwM2M registration update
 | 
					    # Enable/Disable log of transport messages to telemetry. For example, logging of LwM2M registration update
 | 
				
			||||||
@ -1024,10 +1024,6 @@ transport:
 | 
				
			|||||||
  coap:
 | 
					  coap:
 | 
				
			||||||
    # Enable/disable CoAP transport protocol.
 | 
					    # Enable/disable CoAP transport protocol.
 | 
				
			||||||
    enabled: "${COAP_ENABLED:true}"
 | 
					    enabled: "${COAP_ENABLED:true}"
 | 
				
			||||||
    # CoAP bind-address
 | 
					 | 
				
			||||||
    bind_address: "${COAP_BIND_ADDRESS:0.0.0.0}"
 | 
					 | 
				
			||||||
    # CoAP bind port
 | 
					 | 
				
			||||||
    bind_port: "${COAP_BIND_PORT:5683}"
 | 
					 | 
				
			||||||
    # CoaP processing timeout in milliseconds
 | 
					    # CoaP processing timeout in milliseconds
 | 
				
			||||||
    timeout: "${COAP_TIMEOUT:10000}"
 | 
					    timeout: "${COAP_TIMEOUT:10000}"
 | 
				
			||||||
    # CoaP piggyback response timeout in milliseconds
 | 
					    # CoaP piggyback response timeout in milliseconds
 | 
				
			||||||
@ -1036,56 +1032,6 @@ transport:
 | 
				
			|||||||
    psm_activity_timer: "${COAP_PSM_ACTIVITY_TIMER:10000}"
 | 
					    psm_activity_timer: "${COAP_PSM_ACTIVITY_TIMER:10000}"
 | 
				
			||||||
    # Default PSM Activity Timer if not specified in device profile
 | 
					    # Default PSM Activity Timer if not specified in device profile
 | 
				
			||||||
    paging_transmission_window: "${COAP_PAGING_TRANSMISSION_WINDOW:10000}"
 | 
					    paging_transmission_window: "${COAP_PAGING_TRANSMISSION_WINDOW:10000}"
 | 
				
			||||||
    dtls:
 | 
					 | 
				
			||||||
      # Enable/disable DTLS 1.2 support
 | 
					 | 
				
			||||||
      enabled: "${COAP_DTLS_ENABLED:false}"
 | 
					 | 
				
			||||||
      # RFC7925_RETRANSMISSION_TIMEOUT_IN_MILLISECONDS = 9000
 | 
					 | 
				
			||||||
      retransmission_timeout: "${COAP_DTLS_RETRANSMISSION_TIMEOUT_MS:9000}"
 | 
					 | 
				
			||||||
      # CoAP DTLS bind-address
 | 
					 | 
				
			||||||
      bind_address: "${COAP_DTLS_BIND_ADDRESS:0.0.0.0}"
 | 
					 | 
				
			||||||
      # CoAP DTLS bind port
 | 
					 | 
				
			||||||
      bind_port: "${COAP_DTLS_BIND_PORT:5684}"
 | 
					 | 
				
			||||||
      # Server DTLS credentials
 | 
					 | 
				
			||||||
      # CoAP DTLS connection ID length. RFC 9146, Connection Identifier for DTLS 1.2
 | 
					 | 
				
			||||||
      # Default: off
 | 
					 | 
				
			||||||
      # Control usage of DTLS connection ID length (CID).
 | 
					 | 
				
			||||||
      # - 'off' to deactivate it.
 | 
					 | 
				
			||||||
      # - 'on' to activate Connection ID support (same as CID 0 or more 0).
 | 
					 | 
				
			||||||
      # - A positive value defines generated CID size in bytes.
 | 
					 | 
				
			||||||
      # - A value of 0 means we accept using CID but will not generate one for foreign peer (enables support but not for incoming traffic).
 | 
					 | 
				
			||||||
      # - A value between 0 and <= 4: SingleNodeConnectionIdGenerator is used
 | 
					 | 
				
			||||||
      # - A value that are > 4: MultiNodeConnectionIdGenerator is used
 | 
					 | 
				
			||||||
      connection_id_length: "${COAP_DTLS_CONNECTION_ID_LENGTH:}"
 | 
					 | 
				
			||||||
      credentials:
 | 
					 | 
				
			||||||
        # Server credentials type (PEM - pem certificate file; KEYSTORE - java keystore)
 | 
					 | 
				
			||||||
        type: "${COAP_DTLS_CREDENTIALS_TYPE:PEM}"
 | 
					 | 
				
			||||||
        # PEM server credentials
 | 
					 | 
				
			||||||
        pem:
 | 
					 | 
				
			||||||
          # Path to the server certificate file (holds server certificate or certificate chain, may include server private key)
 | 
					 | 
				
			||||||
          cert_file: "${COAP_DTLS_PEM_CERT:coapserver.pem}"
 | 
					 | 
				
			||||||
          # Path to the server certificate private key file. Optional by default. Required if the private key is not present in the server certificate file;
 | 
					 | 
				
			||||||
          key_file: "${COAP_DTLS_PEM_KEY:coapserver_key.pem}"
 | 
					 | 
				
			||||||
          # Server certificate private key password (optional)
 | 
					 | 
				
			||||||
          key_password: "${COAP_DTLS_PEM_KEY_PASSWORD:server_key_password}"
 | 
					 | 
				
			||||||
        # Keystore server credentials
 | 
					 | 
				
			||||||
        keystore:
 | 
					 | 
				
			||||||
          # Type of the key store (JKS or PKCS12)
 | 
					 | 
				
			||||||
          type: "${COAP_DTLS_KEY_STORE_TYPE:JKS}"
 | 
					 | 
				
			||||||
          # Path to the key store that holds the SSL certificate
 | 
					 | 
				
			||||||
          store_file: "${COAP_DTLS_KEY_STORE:coapserver.jks}"
 | 
					 | 
				
			||||||
          # Password used to access the key store
 | 
					 | 
				
			||||||
          store_password: "${COAP_DTLS_KEY_STORE_PASSWORD:server_ks_password}"
 | 
					 | 
				
			||||||
          # Key alias
 | 
					 | 
				
			||||||
          key_alias: "${COAP_DTLS_KEY_ALIAS:serveralias}"
 | 
					 | 
				
			||||||
          # Password used to access the key
 | 
					 | 
				
			||||||
          key_password: "${COAP_DTLS_KEY_PASSWORD:server_key_password}"
 | 
					 | 
				
			||||||
      x509:
 | 
					 | 
				
			||||||
        # Skip certificate validity check for client certificates.
 | 
					 | 
				
			||||||
        skip_validity_check_for_client_cert: "${TB_COAP_X509_DTLS_SKIP_VALIDITY_CHECK_FOR_CLIENT_CERT:false}"
 | 
					 | 
				
			||||||
        # Inactivity timeout of DTLS session. Used to clean cache
 | 
					 | 
				
			||||||
        dtls_session_inactivity_timeout: "${TB_COAP_X509_DTLS_SESSION_INACTIVITY_TIMEOUT:86400000}"
 | 
					 | 
				
			||||||
        # Interval of periodic eviction of the timed-out DTLS sessions
 | 
					 | 
				
			||||||
        dtls_session_report_timeout: "${TB_COAP_X509_DTLS_SESSION_REPORT_TIMEOUT:1800000}"
 | 
					 | 
				
			||||||
  # Local LwM2M transport parameters
 | 
					  # Local LwM2M transport parameters
 | 
				
			||||||
  lwm2m:
 | 
					  lwm2m:
 | 
				
			||||||
    # Enable/disable LwM2M transport protocol.
 | 
					    # Enable/disable LwM2M transport protocol.
 | 
				
			||||||
@ -1250,6 +1196,65 @@ transport:
 | 
				
			|||||||
    # Interval of transport statistics logging
 | 
					    # Interval of transport statistics logging
 | 
				
			||||||
    print-interval-ms: "${TB_TRANSPORT_STATS_PRINT_INTERVAL_MS:60000}"
 | 
					    print-interval-ms: "${TB_TRANSPORT_STATS_PRINT_INTERVAL_MS:60000}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# CoAP server parameters
 | 
				
			||||||
 | 
					coap:
 | 
				
			||||||
 | 
					  # Enable/disable coap server.
 | 
				
			||||||
 | 
					  enabled: "${COAP_SERVER_ENABLED:true}"
 | 
				
			||||||
 | 
					  # CoAP bind address
 | 
				
			||||||
 | 
					  bind_address: "${COAP_BIND_ADDRESS:0.0.0.0}"
 | 
				
			||||||
 | 
					  # CoAP bind port
 | 
				
			||||||
 | 
					  bind_port: "${COAP_BIND_PORT:5683}"
 | 
				
			||||||
 | 
					  dtls:
 | 
				
			||||||
 | 
					    # Enable/disable DTLS 1.2 support
 | 
				
			||||||
 | 
					    enabled: "${COAP_DTLS_ENABLED:false}"
 | 
				
			||||||
 | 
					    # RFC7925_RETRANSMISSION_TIMEOUT_IN_MILLISECONDS = 9000
 | 
				
			||||||
 | 
					    retransmission_timeout: "${COAP_DTLS_RETRANSMISSION_TIMEOUT_MS:9000}"
 | 
				
			||||||
 | 
					    # CoAP DTLS bind address
 | 
				
			||||||
 | 
					    bind_address: "${COAP_DTLS_BIND_ADDRESS:0.0.0.0}"
 | 
				
			||||||
 | 
					    # CoAP DTLS bind port
 | 
				
			||||||
 | 
					    bind_port: "${COAP_DTLS_BIND_PORT:5684}"
 | 
				
			||||||
 | 
					    # CoAP DTLS connection ID length. RFC 9146, Connection Identifier for DTLS 1.2
 | 
				
			||||||
 | 
					    # Default: off
 | 
				
			||||||
 | 
					    # Control usage of DTLS connection ID length (CID).
 | 
				
			||||||
 | 
					    # - 'off' to deactivate it.
 | 
				
			||||||
 | 
					    # - 'on' to activate Connection ID support (same as CID 0 or more 0).
 | 
				
			||||||
 | 
					    # - A positive value defines generated CID size in bytes.
 | 
				
			||||||
 | 
					    # - A value of 0 means we accept using CID but will not generate one for foreign peer (enables support but not for incoming traffic).
 | 
				
			||||||
 | 
					    # - A value between 0 and <= 4: SingleNodeConnectionIdGenerator is used
 | 
				
			||||||
 | 
					    # - A value that are > 4: MultiNodeConnectionIdGenerator is used
 | 
				
			||||||
 | 
					    connection_id_length: "${COAP_DTLS_CONNECTION_ID_LENGTH:}"
 | 
				
			||||||
 | 
					    # Server DTLS credentials
 | 
				
			||||||
 | 
					    credentials:
 | 
				
			||||||
 | 
					      # Server credentials type (PEM - pem certificate file; KEYSTORE - java keystore)
 | 
				
			||||||
 | 
					      type: "${COAP_DTLS_CREDENTIALS_TYPE:PEM}"
 | 
				
			||||||
 | 
					      # PEM server credentials
 | 
				
			||||||
 | 
					      pem:
 | 
				
			||||||
 | 
					        # Path to the server certificate file (holds server certificate or certificate chain, may include server private key)
 | 
				
			||||||
 | 
					        cert_file: "${COAP_DTLS_PEM_CERT:coapserver.pem}"
 | 
				
			||||||
 | 
					        # Path to the server certificate private key file. Optional by default. Required if the private key is not present in the server certificate file;
 | 
				
			||||||
 | 
					        key_file: "${COAP_DTLS_PEM_KEY:coapserver_key.pem}"
 | 
				
			||||||
 | 
					        # Server certificate private key password (optional)
 | 
				
			||||||
 | 
					        key_password: "${COAP_DTLS_PEM_KEY_PASSWORD:server_key_password}"
 | 
				
			||||||
 | 
					      # Keystore server credentials
 | 
				
			||||||
 | 
					      keystore:
 | 
				
			||||||
 | 
					        # Type of the key store (JKS or PKCS12)
 | 
				
			||||||
 | 
					        type: "${COAP_DTLS_KEY_STORE_TYPE:JKS}"
 | 
				
			||||||
 | 
					        # Path to the key store that holds the SSL certificate
 | 
				
			||||||
 | 
					        store_file: "${COAP_DTLS_KEY_STORE:coapserver.jks}"
 | 
				
			||||||
 | 
					        # Password used to access the key store
 | 
				
			||||||
 | 
					        store_password: "${COAP_DTLS_KEY_STORE_PASSWORD:server_ks_password}"
 | 
				
			||||||
 | 
					        # Key alias
 | 
				
			||||||
 | 
					        key_alias: "${COAP_DTLS_KEY_ALIAS:serveralias}"
 | 
				
			||||||
 | 
					        # Password used to access the key
 | 
				
			||||||
 | 
					        key_password: "${COAP_DTLS_KEY_PASSWORD:server_key_password}"
 | 
				
			||||||
 | 
					    x509:
 | 
				
			||||||
 | 
					      # Skip certificate validity check for client certificates.
 | 
				
			||||||
 | 
					      skip_validity_check_for_client_cert: "${TB_COAP_X509_DTLS_SKIP_VALIDITY_CHECK_FOR_CLIENT_CERT:false}"
 | 
				
			||||||
 | 
					      # Inactivity timeout of DTLS session. Used to cleanup cache
 | 
				
			||||||
 | 
					      dtls_session_inactivity_timeout: "${TB_COAP_X509_DTLS_SESSION_INACTIVITY_TIMEOUT:86400000}"
 | 
				
			||||||
 | 
					      # Interval of periodic eviction of the timed-out DTLS sessions
 | 
				
			||||||
 | 
					      dtls_session_report_timeout: "${TB_COAP_X509_DTLS_SESSION_REPORT_TIMEOUT:1800000}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Device connectivity parameters
 | 
					# Device connectivity parameters
 | 
				
			||||||
device:
 | 
					device:
 | 
				
			||||||
  connectivity:
 | 
					  connectivity:
 | 
				
			||||||
 | 
				
			|||||||
@ -27,29 +27,13 @@ import org.springframework.stereotype.Component;
 | 
				
			|||||||
public class CoapServerContext {
 | 
					public class CoapServerContext {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Getter
 | 
					    @Getter
 | 
				
			||||||
    @Value("${transport.coap.bind_address}")
 | 
					    @Value("${coap.bind_address}")
 | 
				
			||||||
    private String host;
 | 
					    private String host;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Getter
 | 
					    @Getter
 | 
				
			||||||
    @Value("${transport.coap.bind_port}")
 | 
					    @Value("${coap.bind_port}")
 | 
				
			||||||
    private Integer port;
 | 
					    private Integer port;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Getter
 | 
					 | 
				
			||||||
    @Value("${transport.coap.timeout}")
 | 
					 | 
				
			||||||
    private Long timeout;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Getter
 | 
					 | 
				
			||||||
    @Value("${transport.coap.piggyback_timeout}")
 | 
					 | 
				
			||||||
    private Long piggybackTimeout;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Getter
 | 
					 | 
				
			||||||
    @Value("${transport.coap.psm_activity_timer:10000}")
 | 
					 | 
				
			||||||
    private long psmActivityTimer;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Getter
 | 
					 | 
				
			||||||
    @Value("${transport.coap.paging_transmission_window:10000}")
 | 
					 | 
				
			||||||
    private long pagingTransmissionWindow;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Getter
 | 
					    @Getter
 | 
				
			||||||
    @Autowired(required = false)
 | 
					    @Autowired(required = false)
 | 
				
			||||||
    private TbCoapDtlsSettings dtlsSettings;
 | 
					    private TbCoapDtlsSettings dtlsSettings;
 | 
				
			||||||
 | 
				
			|||||||
@ -26,9 +26,4 @@ public interface CoapServerService {
 | 
				
			|||||||
    CoapServer getCoapServer() throws UnknownHostException;
 | 
					    CoapServer getCoapServer() throws UnknownHostException;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ConcurrentMap<InetSocketAddress, TbCoapDtlsSessionInfo> getDtlsSessionsMap();
 | 
					    ConcurrentMap<InetSocketAddress, TbCoapDtlsSessionInfo> getDtlsSessionsMap();
 | 
				
			||||||
 | 
					 | 
				
			||||||
    long getTimeout();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    long getPiggybackTimeout();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -83,16 +83,6 @@ public class DefaultCoapServerService implements CoapServerService {
 | 
				
			|||||||
        return tbDtlsCertificateVerifier != null ? tbDtlsCertificateVerifier.getTbCoapDtlsSessionsMap() : null;
 | 
					        return tbDtlsCertificateVerifier != null ? tbDtlsCertificateVerifier.getTbCoapDtlsSessionsMap() : null;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					 | 
				
			||||||
    public long getTimeout() {
 | 
					 | 
				
			||||||
        return coapServerContext.getTimeout();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Override
 | 
					 | 
				
			||||||
    public long getPiggybackTimeout() {
 | 
					 | 
				
			||||||
        return coapServerContext.getPiggybackTimeout();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    private CoapServer createCoapServer() throws UnknownHostException {
 | 
					    private CoapServer createCoapServer() throws UnknownHostException {
 | 
				
			||||||
        Configuration networkConfig = new Configuration();
 | 
					        Configuration networkConfig = new Configuration();
 | 
				
			||||||
        networkConfig.set(CoapConfig.BLOCKWISE_STRICT_BLOCK2_OPTION, true);
 | 
					        networkConfig.set(CoapConfig.BLOCKWISE_STRICT_BLOCK2_OPTION, true);
 | 
				
			||||||
 | 
				
			|||||||
@ -50,24 +50,24 @@ import static org.eclipse.californium.scandium.config.DtlsConfig.DtlsRole.SERVER
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
@Getter
 | 
					@Getter
 | 
				
			||||||
@Slf4j
 | 
					@Slf4j
 | 
				
			||||||
@ConditionalOnProperty(prefix = "transport.coap.dtls", value = "enabled", havingValue = "true", matchIfMissing = false)
 | 
					@ConditionalOnProperty(prefix = "coap.dtls", value = "enabled", havingValue = "true")
 | 
				
			||||||
@Component
 | 
					@Component
 | 
				
			||||||
public class TbCoapDtlsSettings {
 | 
					public class TbCoapDtlsSettings {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Value("${transport.coap.dtls.bind_address}")
 | 
					    @Value("${coap.dtls.bind_address}")
 | 
				
			||||||
    private String host;
 | 
					    private String host;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Value("${transport.coap.dtls.bind_port}")
 | 
					    @Value("${coap.dtls.bind_port}")
 | 
				
			||||||
    private Integer port;
 | 
					    private Integer port;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Value("${transport.coap.dtls.retransmission_timeout:9000}")
 | 
					    @Value("${coap.dtls.retransmission_timeout:9000}")
 | 
				
			||||||
    private int dtlsRetransmissionTimeout;
 | 
					    private int dtlsRetransmissionTimeout;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Value("${transport.coap.dtls.connection_id_length:}")
 | 
					    @Value("${coap.dtls.connection_id_length:}")
 | 
				
			||||||
    private Integer cIdLength;
 | 
					    private Integer cIdLength;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Bean
 | 
					    @Bean
 | 
				
			||||||
    @ConfigurationProperties(prefix = "transport.coap.dtls.credentials")
 | 
					    @ConfigurationProperties(prefix = "coap.dtls.credentials")
 | 
				
			||||||
    public SslCredentialsConfig coapDtlsCredentials() {
 | 
					    public SslCredentialsConfig coapDtlsCredentials() {
 | 
				
			||||||
        return new SslCredentialsConfig("COAP DTLS Credentials", false);
 | 
					        return new SslCredentialsConfig("COAP DTLS Credentials", false);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -76,19 +76,19 @@ public class TbCoapDtlsSettings {
 | 
				
			|||||||
    @Qualifier("coapDtlsCredentials")
 | 
					    @Qualifier("coapDtlsCredentials")
 | 
				
			||||||
    private SslCredentialsConfig coapDtlsCredentialsConfig;
 | 
					    private SslCredentialsConfig coapDtlsCredentialsConfig;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Value("${transport.coap.dtls.x509.skip_validity_check_for_client_cert:false}")
 | 
					    @Value("${coap.dtls.x509.skip_validity_check_for_client_cert:false}")
 | 
				
			||||||
    private boolean skipValidityCheckForClientCert;
 | 
					    private boolean skipValidityCheckForClientCert;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Value("${transport.coap.dtls.x509.dtls_session_inactivity_timeout:86400000}")
 | 
					    @Value("${coap.dtls.x509.dtls_session_inactivity_timeout:86400000}")
 | 
				
			||||||
    private long dtlsSessionInactivityTimeout;
 | 
					    private long dtlsSessionInactivityTimeout;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Value("${transport.coap.dtls.x509.dtls_session_report_timeout:1800000}")
 | 
					    @Value("${coap.dtls.x509.dtls_session_report_timeout:1800000}")
 | 
				
			||||||
    private long dtlsSessionReportTimeout;
 | 
					    private long dtlsSessionReportTimeout;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Autowired
 | 
					    @Autowired(required = false)
 | 
				
			||||||
    private TransportService transportService;
 | 
					    private TransportService transportService;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Autowired
 | 
					    @Autowired(required = false)
 | 
				
			||||||
    private TbServiceInfoProvider serviceInfoProvider;
 | 
					    private TbServiceInfoProvider serviceInfoProvider;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public DtlsConnectorConfig dtlsConnectorConfig(Configuration configuration) throws UnknownHostException {
 | 
					    public DtlsConnectorConfig dtlsConnectorConfig(Configuration configuration) throws UnknownHostException {
 | 
				
			||||||
@ -100,8 +100,8 @@ public class TbCoapDtlsSettings {
 | 
				
			|||||||
        configBuilder.set(DTLS_CLIENT_AUTHENTICATION_MODE, WANTED);
 | 
					        configBuilder.set(DTLS_CLIENT_AUTHENTICATION_MODE, WANTED);
 | 
				
			||||||
        configBuilder.set(DTLS_RETRANSMISSION_TIMEOUT, dtlsRetransmissionTimeout, MILLISECONDS);
 | 
					        configBuilder.set(DTLS_RETRANSMISSION_TIMEOUT, dtlsRetransmissionTimeout, MILLISECONDS);
 | 
				
			||||||
        configBuilder.set(DTLS_ROLE, SERVER_ONLY);
 | 
					        configBuilder.set(DTLS_ROLE, SERVER_ONLY);
 | 
				
			||||||
        configBuilder.set(DTLS_CONNECTION_ID_LENGTH, cIdLength);
 | 
					 | 
				
			||||||
        if (cIdLength != null) {
 | 
					        if (cIdLength != null) {
 | 
				
			||||||
 | 
					            configBuilder.set(DTLS_CONNECTION_ID_LENGTH, cIdLength);
 | 
				
			||||||
            if (cIdLength > 4) {
 | 
					            if (cIdLength > 4) {
 | 
				
			||||||
                configBuilder.set(DTLS_CONNECTION_ID_NODE_ID, 0);
 | 
					                configBuilder.set(DTLS_CONNECTION_ID_NODE_ID, 0);
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
 | 
				
			|||||||
@ -21,6 +21,6 @@ import java.lang.annotation.Retention;
 | 
				
			|||||||
import java.lang.annotation.RetentionPolicy;
 | 
					import java.lang.annotation.RetentionPolicy;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Retention(RetentionPolicy.RUNTIME)
 | 
					@Retention(RetentionPolicy.RUNTIME)
 | 
				
			||||||
@ConditionalOnExpression("'${service.type:null}'=='tb-transport' || ('${service.type:null}'=='monolith' && '${transport.api_enabled:true}'=='true' && '${transport.coap.enabled}'=='true')")
 | 
					@ConditionalOnExpression("'${service.type:null}'=='tb-transport' || ('${service.type:null}'=='monolith' && '${transport.api_enabled:true}'=='true' && '${coap.enabled}'=='true')")
 | 
				
			||||||
public @interface TbCoapServerComponent {
 | 
					public @interface TbCoapServerComponent {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -0,0 +1,27 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Copyright © 2016-2024 The Thingsboard Authors
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Licensed 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.thingsboard.server.coapserver;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.lang.annotation.Retention;
 | 
				
			||||||
 | 
					import java.lang.annotation.RetentionPolicy;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Retention(RetentionPolicy.RUNTIME)
 | 
				
			||||||
 | 
					@ConditionalOnExpression("'${service.type:null}'=='tb-transport' || " +
 | 
				
			||||||
 | 
					        "('${service.type:null}'=='monolith' && '${transport.api_enabled:true}'=='true' && '${coap.enabled}'=='true' && '${transport.coap.enabled}'=='true')")
 | 
				
			||||||
 | 
					public @interface TbCoapTransportComponent {
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -28,14 +28,14 @@ import static org.assertj.core.api.Assertions.assertThat;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
@SpringBootTest(classes = TbCoapDtlsSettings.class)
 | 
					@SpringBootTest(classes = TbCoapDtlsSettings.class)
 | 
				
			||||||
@TestPropertySource(properties = {
 | 
					@TestPropertySource(properties = {
 | 
				
			||||||
        "transport.coap.dtls.enabled=true",
 | 
					        "coap.dtls.enabled=true",
 | 
				
			||||||
        "transport.coap.dtls.bind_address=192.168.1.1",
 | 
					        "coap.dtls.bind_address=192.168.1.1",
 | 
				
			||||||
        "transport.coap.dtls.bind_port=1234",
 | 
					        "coap.dtls.bind_port=1234",
 | 
				
			||||||
        "transport.coap.dtls.retransmission_timeout=100",
 | 
					        "coap.dtls.retransmission_timeout=100",
 | 
				
			||||||
        "transport.coap.dtls.connection_id_length=500",
 | 
					        "coap.dtls.connection_id_length=500",
 | 
				
			||||||
        "transport.coap.dtls.x509.skip_validity_check_for_client_cert=true",
 | 
					        "coap.dtls.x509.skip_validity_check_for_client_cert=true",
 | 
				
			||||||
        "transport.coap.dtls.x509.dtls_session_inactivity_timeout=1000",
 | 
					        "coap.dtls.x509.dtls_session_inactivity_timeout=1000",
 | 
				
			||||||
        "transport.coap.dtls.x509.dtls_session_report_timeout=3000",
 | 
					        "coap.dtls.x509.dtls_session_report_timeout=3000",
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
class TbCoapDtlsSettingsTest {
 | 
					class TbCoapDtlsSettingsTest {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -19,8 +19,8 @@ import lombok.Getter;
 | 
				
			|||||||
import lombok.extern.slf4j.Slf4j;
 | 
					import lombok.extern.slf4j.Slf4j;
 | 
				
			||||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
import org.springframework.beans.factory.annotation.Value;
 | 
					import org.springframework.beans.factory.annotation.Value;
 | 
				
			||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
 | 
					 | 
				
			||||||
import org.springframework.stereotype.Component;
 | 
					import org.springframework.stereotype.Component;
 | 
				
			||||||
 | 
					import org.thingsboard.server.coapserver.TbCoapTransportComponent;
 | 
				
			||||||
import org.thingsboard.server.common.transport.TransportContext;
 | 
					import org.thingsboard.server.common.transport.TransportContext;
 | 
				
			||||||
import org.thingsboard.server.gen.transport.TransportProtos;
 | 
					import org.thingsboard.server.gen.transport.TransportProtos;
 | 
				
			||||||
import org.thingsboard.server.transport.coap.adaptors.JsonCoapAdaptor;
 | 
					import org.thingsboard.server.transport.coap.adaptors.JsonCoapAdaptor;
 | 
				
			||||||
@ -36,7 +36,7 @@ import java.util.concurrent.ConcurrentMap;
 | 
				
			|||||||
 * Created by ashvayka on 18.10.18.
 | 
					 * Created by ashvayka on 18.10.18.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@Slf4j
 | 
					@Slf4j
 | 
				
			||||||
@ConditionalOnExpression("'${service.type:null}'=='tb-transport' || ('${service.type:null}'=='monolith' && '${transport.api_enabled:true}'=='true' && '${transport.coap.enabled}'=='true')")
 | 
					@TbCoapTransportComponent
 | 
				
			||||||
@Component
 | 
					@Component
 | 
				
			||||||
@Getter
 | 
					@Getter
 | 
				
			||||||
public class CoapTransportContext extends TransportContext {
 | 
					public class CoapTransportContext extends TransportContext {
 | 
				
			||||||
@ -44,6 +44,22 @@ public class CoapTransportContext extends TransportContext {
 | 
				
			|||||||
    @Value("${transport.sessions.report_timeout}")
 | 
					    @Value("${transport.sessions.report_timeout}")
 | 
				
			||||||
    private long sessionReportTimeout;
 | 
					    private long sessionReportTimeout;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Getter
 | 
				
			||||||
 | 
					    @Value("${transport.coap.timeout}")
 | 
				
			||||||
 | 
					    private Long timeout;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Getter
 | 
				
			||||||
 | 
					    @Value("${transport.coap.piggyback_timeout}")
 | 
				
			||||||
 | 
					    private Long piggybackTimeout;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Getter
 | 
				
			||||||
 | 
					    @Value("${transport.coap.psm_activity_timer:10000}")
 | 
				
			||||||
 | 
					    private long psmActivityTimer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Getter
 | 
				
			||||||
 | 
					    @Value("${transport.coap.paging_transmission_window:10000}")
 | 
				
			||||||
 | 
					    private long pagingTransmissionWindow;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Autowired
 | 
					    @Autowired
 | 
				
			||||||
    private JsonCoapAdaptor jsonCoapAdaptor;
 | 
					    private JsonCoapAdaptor jsonCoapAdaptor;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -75,8 +75,8 @@ public class CoapTransportResource extends AbstractCoapTransportResource {
 | 
				
			|||||||
        this.setObservable(true); // enable observing
 | 
					        this.setObservable(true); // enable observing
 | 
				
			||||||
        this.addObserver(new CoapResourceObserver());
 | 
					        this.addObserver(new CoapResourceObserver());
 | 
				
			||||||
        this.dtlsSessionsMap = coapServerService.getDtlsSessionsMap();
 | 
					        this.dtlsSessionsMap = coapServerService.getDtlsSessionsMap();
 | 
				
			||||||
        this.timeout = coapServerService.getTimeout();
 | 
					        this.timeout = ctx.getTimeout();
 | 
				
			||||||
        this.piggybackTimeout = coapServerService.getPiggybackTimeout();
 | 
					        this.piggybackTimeout = ctx.getPiggybackTimeout();
 | 
				
			||||||
        this.clients = ctx.getClientContext();
 | 
					        this.clients = ctx.getClientContext();
 | 
				
			||||||
        long sessionReportTimeout = ctx.getSessionReportTimeout();
 | 
					        long sessionReportTimeout = ctx.getSessionReportTimeout();
 | 
				
			||||||
        ctx.getScheduler().scheduleAtFixedRate(clients::reportActivity, new Random().nextInt((int) sessionReportTimeout), sessionReportTimeout, TimeUnit.MILLISECONDS);
 | 
					        ctx.getScheduler().scheduleAtFixedRate(clients::reportActivity, new Random().nextInt((int) sessionReportTimeout), sessionReportTimeout, TimeUnit.MILLISECONDS);
 | 
				
			||||||
 | 
				
			|||||||
@ -15,24 +15,24 @@
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
package org.thingsboard.server.transport.coap;
 | 
					package org.thingsboard.server.transport.coap;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import jakarta.annotation.PostConstruct;
 | 
				
			||||||
 | 
					import jakarta.annotation.PreDestroy;
 | 
				
			||||||
import lombok.extern.slf4j.Slf4j;
 | 
					import lombok.extern.slf4j.Slf4j;
 | 
				
			||||||
import org.eclipse.californium.core.CoapResource;
 | 
					import org.eclipse.californium.core.CoapResource;
 | 
				
			||||||
import org.eclipse.californium.core.CoapServer;
 | 
					import org.eclipse.californium.core.CoapServer;
 | 
				
			||||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
import org.springframework.stereotype.Service;
 | 
					import org.springframework.stereotype.Service;
 | 
				
			||||||
import org.thingsboard.server.coapserver.CoapServerService;
 | 
					import org.thingsboard.server.coapserver.CoapServerService;
 | 
				
			||||||
import org.thingsboard.server.coapserver.TbCoapServerComponent;
 | 
					import org.thingsboard.server.coapserver.TbCoapTransportComponent;
 | 
				
			||||||
import org.thingsboard.server.common.data.DataConstants;
 | 
					import org.thingsboard.server.common.data.DataConstants;
 | 
				
			||||||
import org.thingsboard.server.common.data.TbTransportService;
 | 
					import org.thingsboard.server.common.data.TbTransportService;
 | 
				
			||||||
import org.thingsboard.server.common.data.ota.OtaPackageType;
 | 
					import org.thingsboard.server.common.data.ota.OtaPackageType;
 | 
				
			||||||
import org.thingsboard.server.transport.coap.efento.CoapEfentoTransportResource;
 | 
					import org.thingsboard.server.transport.coap.efento.CoapEfentoTransportResource;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import jakarta.annotation.PostConstruct;
 | 
					 | 
				
			||||||
import jakarta.annotation.PreDestroy;
 | 
					 | 
				
			||||||
import java.net.UnknownHostException;
 | 
					import java.net.UnknownHostException;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Service("CoapTransportService")
 | 
					@Service("CoapTransportService")
 | 
				
			||||||
@TbCoapServerComponent
 | 
					@TbCoapTransportComponent
 | 
				
			||||||
@Slf4j
 | 
					@Slf4j
 | 
				
			||||||
public class CoapTransportService implements TbTransportService {
 | 
					public class CoapTransportService implements TbTransportService {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -21,11 +21,11 @@ import org.eclipse.californium.core.coap.CoAP;
 | 
				
			|||||||
import org.eclipse.californium.core.coap.Response;
 | 
					import org.eclipse.californium.core.coap.Response;
 | 
				
			||||||
import org.eclipse.californium.core.observe.ObserveRelation;
 | 
					import org.eclipse.californium.core.observe.ObserveRelation;
 | 
				
			||||||
import org.eclipse.californium.core.server.resources.CoapExchange;
 | 
					import org.eclipse.californium.core.server.resources.CoapExchange;
 | 
				
			||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
 | 
					 | 
				
			||||||
import org.springframework.context.annotation.Lazy;
 | 
					import org.springframework.context.annotation.Lazy;
 | 
				
			||||||
import org.springframework.context.event.EventListener;
 | 
					import org.springframework.context.event.EventListener;
 | 
				
			||||||
import org.springframework.stereotype.Service;
 | 
					import org.springframework.stereotype.Service;
 | 
				
			||||||
import org.thingsboard.server.coapserver.CoapServerContext;
 | 
					import org.thingsboard.server.coapserver.CoapServerContext;
 | 
				
			||||||
 | 
					import org.thingsboard.server.coapserver.TbCoapTransportComponent;
 | 
				
			||||||
import org.thingsboard.server.common.adaptor.AdaptorException;
 | 
					import org.thingsboard.server.common.adaptor.AdaptorException;
 | 
				
			||||||
import org.thingsboard.server.common.data.DataConstants;
 | 
					import org.thingsboard.server.common.data.DataConstants;
 | 
				
			||||||
import org.thingsboard.server.common.data.Device;
 | 
					import org.thingsboard.server.common.data.Device;
 | 
				
			||||||
@ -81,7 +81,7 @@ import static org.eclipse.californium.core.coap.Message.NONE;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
@Slf4j
 | 
					@Slf4j
 | 
				
			||||||
@Service
 | 
					@Service
 | 
				
			||||||
@ConditionalOnExpression("'${service.type:null}'=='tb-transport' || ('${service.type:null}'=='monolith' && '${transport.api_enabled:true}'=='true' && '${transport.coap.enabled}'=='true')")
 | 
					@TbCoapTransportComponent
 | 
				
			||||||
public class DefaultCoapClientContext implements CoapClientContext {
 | 
					public class DefaultCoapClientContext implements CoapClientContext {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private final CoapServerContext config;
 | 
					    private final CoapServerContext config;
 | 
				
			||||||
@ -266,7 +266,7 @@ public class DefaultCoapClientContext implements CoapClientContext {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            if (psmActivityTimer == null || psmActivityTimer == 0L) {
 | 
					            if (psmActivityTimer == null || psmActivityTimer == 0L) {
 | 
				
			||||||
                psmActivityTimer = config.getPsmActivityTimer();
 | 
					                psmActivityTimer = transportContext.getPsmActivityTimer();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            timeout = psmActivityTimer;
 | 
					            timeout = psmActivityTimer;
 | 
				
			||||||
@ -277,7 +277,7 @@ public class DefaultCoapClientContext implements CoapClientContext {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            if (pagingTransmissionWindow == null || pagingTransmissionWindow == 0L) {
 | 
					            if (pagingTransmissionWindow == null || pagingTransmissionWindow == 0L) {
 | 
				
			||||||
                pagingTransmissionWindow = config.getPagingTransmissionWindow();
 | 
					                pagingTransmissionWindow = transportContext.getPagingTransmissionWindow();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            timeout = pagingTransmissionWindow;
 | 
					            timeout = pagingTransmissionWindow;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@ -757,7 +757,7 @@ public class DefaultCoapClientContext implements CoapClientContext {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                if (psmActivityTimer == null || psmActivityTimer == 0L) {
 | 
					                if (psmActivityTimer == null || psmActivityTimer == 0L) {
 | 
				
			||||||
                    psmActivityTimer = config.getPsmActivityTimer();
 | 
					                    psmActivityTimer = transportContext.getPsmActivityTimer();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                return timeSinceLastUplink <= psmActivityTimer;
 | 
					                return timeSinceLastUplink <= psmActivityTimer;
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
@ -767,7 +767,7 @@ public class DefaultCoapClientContext implements CoapClientContext {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                if (pagingTransmissionWindow == null || pagingTransmissionWindow == 0L) {
 | 
					                if (pagingTransmissionWindow == null || pagingTransmissionWindow == 0L) {
 | 
				
			||||||
                    pagingTransmissionWindow = config.getPagingTransmissionWindow();
 | 
					                    pagingTransmissionWindow = transportContext.getPagingTransmissionWindow();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                boolean allowed = timeSinceLastUplink <= pagingTransmissionWindow;
 | 
					                boolean allowed = timeSinceLastUplink <= pagingTransmissionWindow;
 | 
				
			||||||
                if (!allowed) {
 | 
					                if (!allowed) {
 | 
				
			||||||
 | 
				
			|||||||
@ -130,13 +130,11 @@ redis:
 | 
				
			|||||||
    # Determines the behavior when a thread requests a connection from the pool but there are no available connections and the pool cannot create more due to the maxTotal configuration
 | 
					    # Determines the behavior when a thread requests a connection from the pool but there are no available connections and the pool cannot create more due to the maxTotal configuration
 | 
				
			||||||
    blockWhenExhausted: "${REDIS_POOL_CONFIG_BLOCK_WHEN_EXHAUSTED:true}"
 | 
					    blockWhenExhausted: "${REDIS_POOL_CONFIG_BLOCK_WHEN_EXHAUSTED:true}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# COAP server parameters
 | 
					 | 
				
			||||||
transport:
 | 
					transport:
 | 
				
			||||||
 | 
					  # Local CoAP transport parameters
 | 
				
			||||||
  coap:
 | 
					  coap:
 | 
				
			||||||
    # CoAP bind-address
 | 
					    # Enable/disable coap transport protocol.
 | 
				
			||||||
    bind_address: "${COAP_BIND_ADDRESS:0.0.0.0}"
 | 
					    enabled: "${COAP_ENABLED:true}"
 | 
				
			||||||
    # CoAP bind port
 | 
					 | 
				
			||||||
    bind_port: "${COAP_BIND_PORT:5683}"
 | 
					 | 
				
			||||||
    # CoaP processing timeout in milliseconds
 | 
					    # CoaP processing timeout in milliseconds
 | 
				
			||||||
    timeout: "${COAP_TIMEOUT:10000}"
 | 
					    timeout: "${COAP_TIMEOUT:10000}"
 | 
				
			||||||
    # CoaP piggyback response timeout in milliseconds
 | 
					    # CoaP piggyback response timeout in milliseconds
 | 
				
			||||||
@ -145,57 +143,6 @@ transport:
 | 
				
			|||||||
    psm_activity_timer: "${COAP_PSM_ACTIVITY_TIMER:10000}"
 | 
					    psm_activity_timer: "${COAP_PSM_ACTIVITY_TIMER:10000}"
 | 
				
			||||||
    # Default PSM Activity Timer if not specified in device profile
 | 
					    # Default PSM Activity Timer if not specified in device profile
 | 
				
			||||||
    paging_transmission_window: "${COAP_PAGING_TRANSMISSION_WINDOW:10000}"
 | 
					    paging_transmission_window: "${COAP_PAGING_TRANSMISSION_WINDOW:10000}"
 | 
				
			||||||
    dtls:
 | 
					 | 
				
			||||||
      # Enable/disable DTLS 1.2 support
 | 
					 | 
				
			||||||
      enabled: "${COAP_DTLS_ENABLED:false}"
 | 
					 | 
				
			||||||
      # RFC7925_RETRANSMISSION_TIMEOUT_IN_MILLISECONDS = 9000
 | 
					 | 
				
			||||||
      retransmission_timeout: "${COAP_DTLS_RETRANSMISSION_TIMEOUT_MS:9000}"
 | 
					 | 
				
			||||||
      # CoAP DTLS bind address
 | 
					 | 
				
			||||||
      bind_address: "${COAP_DTLS_BIND_ADDRESS:0.0.0.0}"
 | 
					 | 
				
			||||||
      # CoAP DTLS bind port
 | 
					 | 
				
			||||||
      bind_port: "${COAP_DTLS_BIND_PORT:5684}"
 | 
					 | 
				
			||||||
      # Server DTLS credentials
 | 
					 | 
				
			||||||
      # Server DTLS credentials
 | 
					 | 
				
			||||||
      # CoAP DTLS connection ID length. RFC 9146, Connection Identifier for DTLS 1.2
 | 
					 | 
				
			||||||
      # Default: off
 | 
					 | 
				
			||||||
      # Control usage of DTLS connection ID length (CID).
 | 
					 | 
				
			||||||
      # - 'off' to deactivate it.
 | 
					 | 
				
			||||||
      # - 'on' to activate Connection ID support (same as CID 0 or more 0).
 | 
					 | 
				
			||||||
      # - A positive value defines generated CID size in bytes.
 | 
					 | 
				
			||||||
      # - A value of 0 means we accept using CID but will not generate one for foreign peer (enables support but not for incoming traffic).
 | 
					 | 
				
			||||||
      # - A value between 0 and <= 4: SingleNodeConnectionIdGenerator is used
 | 
					 | 
				
			||||||
      # - A value that are > 4: MultiNodeConnectionIdGenerator is used
 | 
					 | 
				
			||||||
      connection_id_length: "${COAP_DTLS_CONNECTION_ID_LENGTH:}"
 | 
					 | 
				
			||||||
      credentials:
 | 
					 | 
				
			||||||
        # Server credentials type (PEM - pem certificate file; KEYSTORE - java keystore)
 | 
					 | 
				
			||||||
        type:  "${COAP_DTLS_CREDENTIALS_TYPE:PEM}"
 | 
					 | 
				
			||||||
        # PEM server credentials
 | 
					 | 
				
			||||||
        pem:
 | 
					 | 
				
			||||||
          # Path to the server certificate file (holds server certificate or certificate chain, may include server private key)
 | 
					 | 
				
			||||||
          cert_file: "${COAP_DTLS_PEM_CERT:coapserver.pem}"
 | 
					 | 
				
			||||||
          # Path to the server certificate private key file. Optional by default. Required if the private key is not present in server certificate file;
 | 
					 | 
				
			||||||
          key_file: "${COAP_DTLS_PEM_KEY:coapserver_key.pem}"
 | 
					 | 
				
			||||||
          # Server certificate private key password (optional)
 | 
					 | 
				
			||||||
          key_password: "${COAP_DTLS_PEM_KEY_PASSWORD:server_key_password}"
 | 
					 | 
				
			||||||
        # Keystore server credentials
 | 
					 | 
				
			||||||
        keystore:
 | 
					 | 
				
			||||||
          # Type of the key store (JKS or PKCS12)
 | 
					 | 
				
			||||||
          type: "${COAP_DTLS_KEY_STORE_TYPE:JKS}"
 | 
					 | 
				
			||||||
          # Path to the key store that holds the SSL certificate
 | 
					 | 
				
			||||||
          store_file: "${COAP_DTLS_KEY_STORE:coapserver.jks}"
 | 
					 | 
				
			||||||
          # Password used to access the key store
 | 
					 | 
				
			||||||
          store_password: "${COAP_DTLS_KEY_STORE_PASSWORD:server_ks_password}"
 | 
					 | 
				
			||||||
          # Key alias
 | 
					 | 
				
			||||||
          key_alias: "${COAP_DTLS_KEY_ALIAS:serveralias}"
 | 
					 | 
				
			||||||
          # Password used to access the key
 | 
					 | 
				
			||||||
          key_password: "${COAP_DTLS_KEY_PASSWORD:server_key_password}"
 | 
					 | 
				
			||||||
      x509:
 | 
					 | 
				
			||||||
        # Skip certificate validity check for client certificates.
 | 
					 | 
				
			||||||
        skip_validity_check_for_client_cert: "${TB_COAP_X509_DTLS_SKIP_VALIDITY_CHECK_FOR_CLIENT_CERT:false}"
 | 
					 | 
				
			||||||
        # Inactivity timeout of DTLS session. Used to clean cache
 | 
					 | 
				
			||||||
        dtls_session_inactivity_timeout: "${TB_COAP_X509_DTLS_SESSION_INACTIVITY_TIMEOUT:86400000}"
 | 
					 | 
				
			||||||
        # Interval of periodic eviction of the timed-out DTLS sessions
 | 
					 | 
				
			||||||
        dtls_session_report_timeout: "${TB_COAP_X509_DTLS_SESSION_REPORT_TIMEOUT:1800000}"
 | 
					 | 
				
			||||||
  sessions:
 | 
					  sessions:
 | 
				
			||||||
    # Session inactivity timeout is a global configuration parameter that defines how long the device transport session will be opened after the last message arrives from the device.
 | 
					    # Session inactivity timeout is a global configuration parameter that defines how long the device transport session will be opened after the last message arrives from the device.
 | 
				
			||||||
    # The parameter value is in milliseconds.
 | 
					    # The parameter value is in milliseconds.
 | 
				
			||||||
@ -224,6 +171,65 @@ transport:
 | 
				
			|||||||
    # Interval of transport statistics logging
 | 
					    # Interval of transport statistics logging
 | 
				
			||||||
    print-interval-ms: "${TB_TRANSPORT_STATS_PRINT_INTERVAL_MS:60000}"
 | 
					    print-interval-ms: "${TB_TRANSPORT_STATS_PRINT_INTERVAL_MS:60000}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# CoAP server parameters
 | 
				
			||||||
 | 
					coap:
 | 
				
			||||||
 | 
					  # Enable/disable coap transport protocol.
 | 
				
			||||||
 | 
					  enabled: "${COAP_SERVER_ENABLED:true}"
 | 
				
			||||||
 | 
					  # CoAP bind-address
 | 
				
			||||||
 | 
					  bind_address: "${COAP_BIND_ADDRESS:0.0.0.0}"
 | 
				
			||||||
 | 
					  # CoAP bind port
 | 
				
			||||||
 | 
					  bind_port: "${COAP_BIND_PORT:5683}"
 | 
				
			||||||
 | 
					  dtls:
 | 
				
			||||||
 | 
					    # Enable/disable DTLS 1.2 support
 | 
				
			||||||
 | 
					    enabled: "${COAP_DTLS_ENABLED:false}"
 | 
				
			||||||
 | 
					    # RFC7925_RETRANSMISSION_TIMEOUT_IN_MILLISECONDS = 9000
 | 
				
			||||||
 | 
					    retransmission_timeout: "${COAP_DTLS_RETRANSMISSION_TIMEOUT_MS:9000}"
 | 
				
			||||||
 | 
					    # CoAP DTLS bind address
 | 
				
			||||||
 | 
					    bind_address: "${COAP_DTLS_BIND_ADDRESS:0.0.0.0}"
 | 
				
			||||||
 | 
					    # CoAP DTLS bind port
 | 
				
			||||||
 | 
					    bind_port: "${COAP_DTLS_BIND_PORT:5684}"
 | 
				
			||||||
 | 
					    # CoAP DTLS connection ID length. RFC 9146, Connection Identifier for DTLS 1.2
 | 
				
			||||||
 | 
					    # Default: off
 | 
				
			||||||
 | 
					    # Control usage of DTLS connection ID length (CID).
 | 
				
			||||||
 | 
					    # - 'off' to deactivate it.
 | 
				
			||||||
 | 
					    # - 'on' to activate Connection ID support (same as CID 0 or more 0).
 | 
				
			||||||
 | 
					    # - A positive value defines generated CID size in bytes.
 | 
				
			||||||
 | 
					    # - A value of 0 means we accept using CID but will not generate one for foreign peer (enables support but not for incoming traffic).
 | 
				
			||||||
 | 
					    # - A value between 0 and <= 4: SingleNodeConnectionIdGenerator is used
 | 
				
			||||||
 | 
					    # - A value that are > 4: MultiNodeConnectionIdGenerator is used
 | 
				
			||||||
 | 
					    connection_id_length: "${COAP_DTLS_CONNECTION_ID_LENGTH:}"
 | 
				
			||||||
 | 
					    # Server DTLS credentials
 | 
				
			||||||
 | 
					    credentials:
 | 
				
			||||||
 | 
					      # Server credentials type (PEM - pem certificate file; KEYSTORE - java keystore)
 | 
				
			||||||
 | 
					      type:  "${COAP_DTLS_CREDENTIALS_TYPE:PEM}"
 | 
				
			||||||
 | 
					      # PEM server credentials
 | 
				
			||||||
 | 
					      pem:
 | 
				
			||||||
 | 
					        # Path to the server certificate file (holds server certificate or certificate chain, may include server private key)
 | 
				
			||||||
 | 
					        cert_file: "${COAP_DTLS_PEM_CERT:coapserver.pem}"
 | 
				
			||||||
 | 
					        # Path to the server certificate private key file. Optional by default. Required if the private key is not present in the server certificate file;
 | 
				
			||||||
 | 
					        key_file: "${COAP_DTLS_PEM_KEY:coapserver_key.pem}"
 | 
				
			||||||
 | 
					        # Server certificate private key password (optional)
 | 
				
			||||||
 | 
					        key_password: "${COAP_DTLS_PEM_KEY_PASSWORD:server_key_password}"
 | 
				
			||||||
 | 
					      # Keystore server credentials
 | 
				
			||||||
 | 
					      keystore:
 | 
				
			||||||
 | 
					        # Type of the key store (JKS or PKCS12)
 | 
				
			||||||
 | 
					        type: "${COAP_DTLS_KEY_STORE_TYPE:JKS}"
 | 
				
			||||||
 | 
					        # Path to the key store that holds the SSL certificate
 | 
				
			||||||
 | 
					        store_file: "${COAP_DTLS_KEY_STORE:coapserver.jks}"
 | 
				
			||||||
 | 
					        # Password used to access the key store
 | 
				
			||||||
 | 
					        store_password: "${COAP_DTLS_KEY_STORE_PASSWORD:server_ks_password}"
 | 
				
			||||||
 | 
					        # Key alias
 | 
				
			||||||
 | 
					        key_alias: "${COAP_DTLS_KEY_ALIAS:serveralias}"
 | 
				
			||||||
 | 
					        # Password used to access the key
 | 
				
			||||||
 | 
					        key_password: "${COAP_DTLS_KEY_PASSWORD:server_key_password}"
 | 
				
			||||||
 | 
					    x509:
 | 
				
			||||||
 | 
					      # Skip certificate validity check for client certificates.
 | 
				
			||||||
 | 
					      skip_validity_check_for_client_cert: "${TB_COAP_X509_DTLS_SKIP_VALIDITY_CHECK_FOR_CLIENT_CERT:false}"
 | 
				
			||||||
 | 
					      # Inactivity timeout of DTLS session. Used to cleanup cache
 | 
				
			||||||
 | 
					      dtls_session_inactivity_timeout: "${TB_COAP_X509_DTLS_SESSION_INACTIVITY_TIMEOUT:86400000}"
 | 
				
			||||||
 | 
					      # Interval of periodic eviction of the timed-out DTLS sessions
 | 
				
			||||||
 | 
					      dtls_session_report_timeout: "${TB_COAP_X509_DTLS_SESSION_REPORT_TIMEOUT:1800000}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Queue configuration parameters
 | 
					# Queue configuration parameters
 | 
				
			||||||
queue:
 | 
					queue:
 | 
				
			||||||
  type: "${TB_QUEUE_TYPE:kafka}" # kafka (Apache Kafka) or aws-sqs (AWS SQS) or pubsub (PubSub) or service-bus (Azure Service Bus) or rabbitmq (RabbitMQ)
 | 
					  type: "${TB_QUEUE_TYPE:kafka}" # kafka (Apache Kafka) or aws-sqs (AWS SQS) or pubsub (PubSub) or service-bus (Azure Service Bus) or rabbitmq (RabbitMQ)
 | 
				
			||||||
 | 
				
			|||||||
@ -152,8 +152,6 @@ transport:
 | 
				
			|||||||
  client_side_rpc:
 | 
					  client_side_rpc:
 | 
				
			||||||
    # Processing timeout interval of the RPC command on the CLIENT SIDE. Time in milliseconds
 | 
					    # Processing timeout interval of the RPC command on the CLIENT SIDE. Time in milliseconds
 | 
				
			||||||
    timeout: "${CLIENT_SIDE_RPC_TIMEOUT:60000}"
 | 
					    timeout: "${CLIENT_SIDE_RPC_TIMEOUT:60000}"
 | 
				
			||||||
  # Enable/disable http/mqtt/coap transport protocols (has higher priority than certain protocol's 'enabled' property)
 | 
					 | 
				
			||||||
  api_enabled: "${TB_TRANSPORT_API_ENABLED:true}"
 | 
					 | 
				
			||||||
  log:
 | 
					  log:
 | 
				
			||||||
    # Enable/Disable log of transport messages to telemetry. For example, logging of LwM2M registration update
 | 
					    # Enable/Disable log of transport messages to telemetry. For example, logging of LwM2M registration update
 | 
				
			||||||
    enabled: "${TB_TRANSPORT_LOG_ENABLED:true}"
 | 
					    enabled: "${TB_TRANSPORT_LOG_ENABLED:true}"
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user